coolblaze03 commited on
Commit
d1da7dc
·
verified ·
1 Parent(s): 29a4423

Add files using upload-large-folder tool

Browse files
Files changed (40) hide show
  1. benchmarks/csn-3.12-licensed/src/00036.py +7 -0
  2. benchmarks/csn-3.12-licensed/src/00058.py +4 -0
  3. benchmarks/csn-3.12-licensed/src/00082.py +3 -0
  4. benchmarks/csn-3.12-licensed/src/00090.py +4 -0
  5. benchmarks/csn-3.12-licensed/src/00093.py +8 -0
  6. benchmarks/csn-3.12-licensed/src/00101.py +15 -0
  7. benchmarks/csn-3.12-licensed/src/00103.py +11 -0
  8. benchmarks/csn-3.12-licensed/src/00106.py +6 -0
  9. benchmarks/csn-3.12-licensed/src/00110.py +15 -0
  10. benchmarks/csn-3.12-licensed/src/00139.py +5 -0
  11. benchmarks/csn-3.12-licensed/src/00162.py +13 -0
  12. benchmarks/csn-3.12-licensed/src/00175.py +3 -0
  13. benchmarks/csn-3.12-licensed/src/00196.py +9 -0
  14. benchmarks/csn-3.12-licensed/src/00206.py +23 -0
  15. benchmarks/csn-3.12-licensed/src/00219.py +5 -0
  16. benchmarks/csn-3.12-licensed/src/00246.py +16 -0
  17. benchmarks/csn-3.12-licensed/src/00305.py +14 -0
  18. benchmarks/csn-3.12-licensed/src/00317.py +7 -0
  19. benchmarks/csn-3.12-licensed/src/00333.py +15 -0
  20. benchmarks/csn-3.12-licensed/src/00359.py +4 -0
  21. benchmarks/csn-3.12-licensed/src/00379.py +14 -0
  22. benchmarks/csn-3.12-licensed/src/00440.py +9 -0
  23. benchmarks/csn-3.12-licensed/src/00443.py +11 -0
  24. benchmarks/csn-3.12-licensed/src/00446.py +7 -0
  25. benchmarks/csn-3.12-licensed/src/00447.py +7 -0
  26. benchmarks/csn-3.12-licensed/src/00454.py +8 -0
  27. benchmarks/csn-3.12-licensed/src/00464.py +4 -0
  28. benchmarks/csn-3.12-licensed/src/00467.py +7 -0
  29. benchmarks/csn-3.12-licensed/src/00479.py +5 -0
  30. benchmarks/csn-3.12-licensed/src/00492.py +8 -0
  31. benchmarks/csn-3.12-licensed/src/00511.py +3 -0
  32. benchmarks/csn-3.12-licensed/src/00529.py +16 -0
  33. benchmarks/csn-3.12-licensed/src/00530.py +34 -0
  34. benchmarks/csn-3.12-licensed/src/00538.py +9 -0
  35. benchmarks/csn-3.12-licensed/src/00555.py +8 -0
  36. benchmarks/csn-3.12-licensed/src/00557.py +13 -0
  37. benchmarks/csn-3.12-licensed/src/00567.py +3 -0
  38. benchmarks/csn-3.12-licensed/src/00580.py +47 -0
  39. benchmarks/csn-3.12-licensed/src/00594.py +4 -0
  40. benchmarks/csn-3.12-licensed/src/00595.py +6 -0
benchmarks/csn-3.12-licensed/src/00036.py ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ def add_transformers(line):
2
+ """pass"""
3
+ assert FROM_EXPERIMENTAL.match(line)
4
+ line = FROM_EXPERIMENTAL.sub(' ', line)
5
+ line = line.split('#')[0]
6
+ for trans in line.replace(' ', '').split(','):
7
+ import_transformer(trans)
benchmarks/csn-3.12-licensed/src/00058.py ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ def release_assets(self, release):
2
+ """pass"""
3
+ release = self.as_id(release)
4
+ return self.get_list(url='%s/%s/assets' % (self, release))
benchmarks/csn-3.12-licensed/src/00082.py ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ def check_arrange_act_spacing(self) -> typing.Generator[AAAError, None, None]:
2
+ """pass"""
3
+ yield from self.check_block_spacing(LineType.arrange, LineType.act, 'AAA03 expected 1 blank line before Act block, found {}')
benchmarks/csn-3.12-licensed/src/00090.py ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ def remove_webhook(self):
2
+ """pass"""
3
+ if self._webhook.get('hook_id'):
4
+ self._request('{}/{}'.format(MINUT_WEBHOOKS_URL, self._webhook['hook_id']), request_type='DELETE')
benchmarks/csn-3.12-licensed/src/00093.py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ def put(filenames, file_type='auto', history_id=None):
2
+ """pass"""
3
+ history_id = history_id or os.environ['HISTORY_ID']
4
+ gi = get_galaxy_connection(history_id=history_id)
5
+ for filename in filenames:
6
+ log.debug('Uploading gx=%s history=%s localpath=%s ft=%s', gi, history_id, filename, file_type)
7
+ history = gi.histories.get(history_id)
8
+ history.upload_dataset(filename, file_type=file_type)
benchmarks/csn-3.12-licensed/src/00101.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ def compare_schemas(one, two):
2
+ """pass"""
3
+ one = _normalize_string_type(one)
4
+ two = _normalize_string_type(two)
5
+ _assert_same_types(one, two)
6
+ if isinstance(one, list):
7
+ return _compare_lists(one, two)
8
+ elif isinstance(one, dict):
9
+ return _compare_dicts(one, two)
10
+ elif isinstance(one, SCALAR_TYPES):
11
+ return one == two
12
+ elif one is None:
13
+ return one is two
14
+ else:
15
+ raise RuntimeError('Not allowed type "{type}"'.format(type=type(one).__name__))
benchmarks/csn-3.12-licensed/src/00103.py ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ def convert_ecma_regex_to_python(value):
2
+ """pass"""
3
+ if not is_ecma_regex(value):
4
+ return PythonRegex(value, [])
5
+ parts = value.split('/')
6
+ flags = parts.pop()
7
+ try:
8
+ result_flags = [ECMA_TO_PYTHON_FLAGS[f] for f in flags]
9
+ except KeyError:
10
+ raise ValueError('Wrong flags "{}".'.format(flags))
11
+ return PythonRegex('/'.join(parts[1:]), result_flags)
benchmarks/csn-3.12-licensed/src/00106.py ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ def get_field(self, field_name):
2
+ """pass"""
3
+ for attr_name, field in self:
4
+ if field_name == attr_name:
5
+ return field
6
+ raise errors.FieldNotFound('Field not found', field_name)
benchmarks/csn-3.12-licensed/src/00110.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ def __update(self, row):
2
+ """pass"""
3
+ expr = self.__table.update().values(row)
4
+ for key in self.__update_keys:
5
+ expr = expr.where(getattr(self.__table.c, key) == row[key])
6
+ if self.__autoincrement:
7
+ expr = expr.returning(getattr(self.__table.c, self.__autoincrement))
8
+ res = expr.execute()
9
+ if res.rowcount > 0:
10
+ if self.__autoincrement:
11
+ first = next(iter(res))
12
+ last_row_id = first[0]
13
+ return last_row_id
14
+ return 0
15
+ return None
benchmarks/csn-3.12-licensed/src/00139.py ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ def angle(v1, v2):
2
+ """pass"""
3
+ v1_u = unit_vector(v1)
4
+ v2_u = unit_vector(v2)
5
+ return np.arccos(np.clip(np.dot(v1_u, v2_u), -1.0, 1.0))
benchmarks/csn-3.12-licensed/src/00162.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ def setup_model_event_subscribers(config, model_cls, schema):
2
+ """pass"""
3
+ events_map = get_events_map()
4
+ model_events = schema.get('_event_handlers', {})
5
+ event_kwargs = {'model': model_cls}
6
+ for event_tag, subscribers in model_events.items():
7
+ type_, action = event_tag.split('_')
8
+ event_objects = events_map[type_][action]
9
+ if not isinstance(event_objects, list):
10
+ event_objects = [event_objects]
11
+ for sub_name in subscribers:
12
+ sub_func = resolve_to_callable(sub_name)
13
+ config.subscribe_to_events(sub_func, event_objects, **event_kwargs)
benchmarks/csn-3.12-licensed/src/00175.py ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ def _gen_input_mask(mask):
2
+ """pass"""
3
+ return input_mask(shift=bool(mask & MOD_Shift), lock=bool(mask & MOD_Lock), control=bool(mask & MOD_Control), mod1=bool(mask & MOD_Mod1), mod2=bool(mask & MOD_Mod2), mod3=bool(mask & MOD_Mod3), mod4=bool(mask & MOD_Mod4), mod5=bool(mask & MOD_Mod5))
benchmarks/csn-3.12-licensed/src/00196.py ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ def _compute_radii(self):
2
+ """pass"""
3
+ radii = self._get_user_components('radii')
4
+ if radii is None:
5
+ centers = self.components_['centers']
6
+ n_centers = centers.shape[0]
7
+ max_dist = np.max(pairwise_distances(centers))
8
+ radii = np.ones(n_centers) * max_dist / sqrt(2.0 * n_centers)
9
+ self.components_['radii'] = radii
benchmarks/csn-3.12-licensed/src/00206.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ def download(self, url, path, force_refetch=False, nocache=False):
2
+ """pass"""
3
+ if os.path.isfile(path):
4
+ getLogger().info('File exists, download task skipped -> {path}'.format(path=path))
5
+ return True
6
+ try:
7
+ getLogger().info('Downloading: {url} -> {path}'.format(url=url, path=path))
8
+ response = self.fetch(url, force_refetch=force_refetch, nocache=nocache)
9
+ if response is not None:
10
+ local_file = open(path, 'wb')
11
+ local_file.write(response)
12
+ local_file.close()
13
+ return True
14
+ else:
15
+ return False
16
+ except Exception as e:
17
+ if hasattr(e, 'reason'):
18
+ getLogger().exception('We failed to reach a server. Reason: %s' % (e.reason,))
19
+ elif hasattr(e, 'code'):
20
+ getLogger().exception("The server couldn't fulfill the request. Error code: {code}".format(code=e.code))
21
+ else:
22
+ getLogger().exception('Unknown error: %s' % (e,))
23
+ return False
benchmarks/csn-3.12-licensed/src/00219.py ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ def voice(self):
2
+ """pass"""
3
+ dbid = self.lldb.dbid
4
+ text, lang = self._voiceoverdb.get_text_lang(dbid)
5
+ return (text, lang)
benchmarks/csn-3.12-licensed/src/00246.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ def build(self, columns):
2
+ """pass"""
3
+ self.columns = columns
4
+ default = dict(elements.default('default_'), **_safe_get(self.init_style, 'default_', {}))
5
+ self.style = elements.adopt({c: default for c in columns}, self.init_style)
6
+ self.style['default_'] = default
7
+ self.style['header_'] = self._compose('header_', {'align', 'width'})
8
+ self.style['aggregate_'] = self._compose('aggregate_', {'align', 'width'})
9
+ self.style['separator_'] = _safe_get(self.init_style, 'separator_', elements.default('separator_'))
10
+ lgr.debug('Validating style %r', self.style)
11
+ self.style['width_'] = _safe_get(self.init_style, 'width_', elements.default('width_'))
12
+ elements.validate(self.style)
13
+ self._setup_fields()
14
+ ngaps = len(self.columns) - 1
15
+ self.width_separtor = len(self.style['separator_']) * ngaps
16
+ lgr.debug('Calculated separator width as %d', self.width_separtor)
benchmarks/csn-3.12-licensed/src/00305.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ def _reload(self):
2
+ """pass"""
3
+ ConfigModel = apps.get_model('djconfig.Config')
4
+ cache = {}
5
+ data = dict(ConfigModel.objects.all().values_list('key', 'value'))
6
+ for form_class in self._registry:
7
+ empty_form = form_class()
8
+ cache.update({name: field.initial for name, field in empty_form.fields.items()})
9
+ form = form_class(data={name: _deserialize(data[name], field) for name, field in empty_form.fields.items() if name in data and (not isinstance(field, forms.FileField))})
10
+ form.is_valid()
11
+ cache.update({name: _unlazify(value) for name, value in form.cleaned_data.items() if name in data})
12
+ cache.update({name: data[name] for name, field in empty_form.fields.items() if name in data and isinstance(field, forms.FileField)})
13
+ cache['_updated_at'] = data.get('_updated_at')
14
+ self._cache = cache
benchmarks/csn-3.12-licensed/src/00317.py ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ def receive(self, decode=True):
2
+ """pass"""
3
+ payload = self.socket.recv()
4
+ payload = self.verify(payload)
5
+ if decode:
6
+ payload = self.decode(payload)
7
+ return payload
benchmarks/csn-3.12-licensed/src/00333.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ def get_client(self):
2
+ """pass"""
3
+ if self._ssh is None:
4
+ self._connect()
5
+ return self._ssh
6
+ else:
7
+ try:
8
+ chan = self._ssh.get_transport().open_session()
9
+ except (socket.error, paramiko.SSHException):
10
+ logger.warning('Lost connection, reconnecting...')
11
+ self._ssh.close()
12
+ self._connect()
13
+ else:
14
+ chan.close()
15
+ return self._ssh
benchmarks/csn-3.12-licensed/src/00359.py ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ def get_params_from_sqlalchemy_url(db_url):
2
+ """pass"""
3
+ result = urlsplit(db_url)
4
+ return {'database': result.path[1:], 'host': result.hostname, 'port': result.port, 'username': result.username, 'password': result.password, 'driver': result.scheme}
benchmarks/csn-3.12-licensed/src/00379.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ def stop(self, timeout=10.0):
2
+ """pass"""
3
+ if self._send_greenlet is not None and self._send_queue.qsize() > 0:
4
+ self.wait_send(timeout=timeout)
5
+ if self._send_greenlet is not None:
6
+ gevent.kill(self._send_greenlet)
7
+ self._send_greenlet = None
8
+ if self._error_greenlet is not None:
9
+ gevent.kill(self._error_greenlet)
10
+ self._error_greenlet = None
11
+ if self._feedback_greenlet is not None:
12
+ gevent.kill(self._feedback_greenlet)
13
+ self._feedback_greenlet = None
14
+ return self._send_queue.qsize() < 1
benchmarks/csn-3.12-licensed/src/00440.py ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ def get_history(self, filters=(), pagesize=15, offset=0):
2
+ """pass"""
3
+ response = None
4
+ try:
5
+ response = requests.get(urls.history(self._giid), headers={'Accept': 'application/json, text/javascript, */*; q=0.01', 'Cookie': 'vid={}'.format(self._vid)}, params={'offset': int(offset), 'pagesize': int(pagesize), 'notificationCategories': filters})
6
+ except requests.exceptions.RequestException as ex:
7
+ raise RequestError(ex)
8
+ _validate_response(response)
9
+ return json.loads(response.text)
benchmarks/csn-3.12-licensed/src/00443.py ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ def get_output_cache_key(self, placeholder_name, instance):
2
+ """pass"""
3
+ cachekey = self.get_output_cache_base_key(placeholder_name, instance)
4
+ if self.cache_output_per_site:
5
+ cachekey = '{0}-s{1}'.format(cachekey, settings.SITE_ID)
6
+ if self.cache_output_per_language:
7
+ user_language = get_language()
8
+ if user_language not in self.cache_supported_language_codes:
9
+ user_language = 'unsupported'
10
+ cachekey = '{0}.{1}'.format(cachekey, user_language)
11
+ return cachekey
benchmarks/csn-3.12-licensed/src/00446.py ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ def set_cached_output(self, placeholder_name, instance, output):
2
+ """pass"""
3
+ cachekey = self.get_output_cache_key(placeholder_name, instance)
4
+ if self.cache_timeout is not DEFAULT_TIMEOUT:
5
+ cache.set(cachekey, output, self.cache_timeout)
6
+ else:
7
+ cache.set(cachekey, output)
benchmarks/csn-3.12-licensed/src/00447.py ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ def render(self, request, instance, **kwargs):
2
+ """pass"""
3
+ render_template = self.get_render_template(request, instance, **kwargs)
4
+ if not render_template:
5
+ return str(_(u"{No rendering defined for class '%s'}" % self.__class__.__name__))
6
+ context = self.get_context(request, instance, **kwargs)
7
+ return self.render_to_string(request, render_template, context)
benchmarks/csn-3.12-licensed/src/00454.py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ def init_app(self, app):
2
+ """pass"""
3
+ if not hasattr(app, 'extensions'):
4
+ app.extensions = {}
5
+ app.extensions['flask-jwt-simple'] = self
6
+ self._set_default_configuration_options(app)
7
+ self._set_error_handler_callbacks(app)
8
+ app.config['PROPAGATE_EXCEPTIONS'] = True
benchmarks/csn-3.12-licensed/src/00464.py ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ def treenav_undefined_url(request, item_slug):
2
+ """pass"""
3
+ item = get_object_or_404(treenav.MenuItem, slug=item_slug)
4
+ raise Http404
benchmarks/csn-3.12-licensed/src/00467.py ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ def clean_cache(self, request):
2
+ """pass"""
3
+ treenav.delete_cache()
4
+ self.message_user(request, _('Cache menuitem cache cleaned successfully.'))
5
+ info = (self.model._meta.app_label, self.model._meta.model_name)
6
+ changelist_url = reverse('admin:%s_%s_changelist' % info, current_app=self.admin_site.name)
7
+ return redirect(changelist_url)
benchmarks/csn-3.12-licensed/src/00479.py ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ def _date_based_where(self, type, query, where):
2
+ """pass"""
3
+ value = str(where['value']).zfill(2)
4
+ value = self.parameter(value)
5
+ return "strftime('%s', %s) %s %s" % (type, self.wrap(where['column']), where['operator'], value)
benchmarks/csn-3.12-licensed/src/00492.py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ def _plan_on_valid_line(self, at_line, final_line_count):
2
+ """pass"""
3
+ if at_line == 1 or at_line == final_line_count:
4
+ return True
5
+ after_version = self._lines_seen['version'] and self._lines_seen['version'][0] == 1 and (at_line == 2)
6
+ if after_version:
7
+ return True
8
+ return False
benchmarks/csn-3.12-licensed/src/00511.py ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ def in_file(self, fn: str) -> Iterator[Statement]:
2
+ """pass"""
3
+ yield from self.__file_to_statements.get(fn, [])
benchmarks/csn-3.12-licensed/src/00529.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ def _write_int(fname, data, append=True):
2
+ """pass"""
3
+ data_ex = pexdoc.exh.addex(ValueError, 'There is no data to save to file')
4
+ fos_ex = pexdoc.exh.addex(OSError, 'File *[fname]* could not be created: *[reason]*')
5
+ data_ex(len(data) == 0 or (len(data) == 1 and len(data[0]) == 0))
6
+ try:
7
+ pmisc.make_dir(fname)
8
+ mode = 'w' if append is False else 'a'
9
+ if sys.hexversion < 50331648:
10
+ with open(fname, mode) as file_handle:
11
+ csv.writer(file_handle, delimiter=',').writerows(data)
12
+ else:
13
+ with open(fname, mode, newline='') as file_handle:
14
+ csv.writer(file_handle, delimiter=',').writerows(data)
15
+ except (IOError, OSError) as eobj:
16
+ fos_ex(True, _MF('fname', fname, 'reason', eobj.strerror))
benchmarks/csn-3.12-licensed/src/00530.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ def revdocs2reverts(rev_docs, radius=defaults.RADIUS, use_sha1=False, resort=False, verbose=False):
2
+ """pass"""
3
+ page_rev_docs = groupby(rev_docs, lambda rd: rd.get('page'))
4
+ for page_doc, rev_docs in page_rev_docs:
5
+ if verbose:
6
+ sys.stderr.write(page_doc.get('title') + ': ')
7
+ sys.stderr.flush()
8
+ if resort:
9
+ if verbose:
10
+ sys.stderr.write('(sorting) ')
11
+ sys.stderr.flush()
12
+ rev_docs = sorted(rev_docs, key=lambda r: (r.get('timestamp'), r.get('id')))
13
+ detector = Detector(radius=radius)
14
+ for rev_doc in rev_docs:
15
+ if not use_sha1 and 'text' not in rev_doc:
16
+ logger.warn("Skipping {0}: 'text' field not found in {0}".format(rev_doc['id'], rev_doc))
17
+ continue
18
+ if use_sha1:
19
+ checksum = rev_doc.get('sha1') or DummyChecksum()
20
+ elif 'text' in rev_doc:
21
+ text_bytes = bytes(rev_doc['text'], 'utf8', 'replace')
22
+ checksum = hashlib.sha1(text_bytes).digest()
23
+ revert = detector.process(checksum, rev_doc)
24
+ if revert:
25
+ yield revert.to_json()
26
+ if verbose:
27
+ sys.stderr.write('r')
28
+ sys.stderr.flush()
29
+ elif verbose:
30
+ sys.stderr.write('.')
31
+ sys.stderr.flush()
32
+ if verbose:
33
+ sys.stderr.write('\n')
34
+ sys.stderr.flush()
benchmarks/csn-3.12-licensed/src/00538.py ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ def at_line(self, line: FileLine) -> Iterator[InsertionPoint]:
2
+ """pass"""
3
+ logger.debug('finding insertion points at line: %s', str(line))
4
+ filename = line.filename
5
+ line_num = line.num
6
+ for ins in self.in_file(filename):
7
+ if line_num == ins.location.line:
8
+ logger.debug('found insertion point at line [%s]: %s', str(line), ins)
9
+ yield ins
benchmarks/csn-3.12-licensed/src/00555.py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ def get_commit_url(repo_url):
2
+ """pass"""
3
+ if 'github.com' in repo_url:
4
+ return repo_url[:-4] if repo_url.endswith('.git') else repo_url
5
+ if 'git.openstack.org' in repo_url:
6
+ uri = '/'.join(repo_url.split('/')[-2:])
7
+ return 'https://github.com/{0}'.format(uri)
8
+ return repo_url
benchmarks/csn-3.12-licensed/src/00557.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ def checkout(repo, ref):
2
+ """pass"""
3
+ if ref in repo.branches:
4
+ log.warn('Removing local branch {b} for repo {r}'.format(b=ref, r=repo))
5
+ repo.head.reset(index=True, working_tree=True)
6
+ repo.git.checkout(repo.head.commit.hexsha)
7
+ repo.delete_head(ref, '--force')
8
+ log.info('Checkout out repo {repo} to ref {ref}'.format(repo=repo, ref=ref))
9
+ repo.head.reset(index=True, working_tree=True)
10
+ repo.git.checkout(ref)
11
+ repo.head.reset(index=True, working_tree=True)
12
+ sha = repo.head.commit.hexsha
13
+ log.info('Current SHA for repo {repo} is {sha}'.format(repo=repo, sha=sha))
benchmarks/csn-3.12-licensed/src/00567.py ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ def save_list(key, *values):
2
+ """pass"""
3
+ return json.dumps({key: [_get_json(value) for value in values]})
benchmarks/csn-3.12-licensed/src/00580.py ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ def generate_method_definition(func):
2
+ """pass"""
3
+ indent = 4
4
+ method_definition = ' ' * indent + 'def ' + func['name']
5
+ params_required = [param for param in func['arguments'] if param['is_required']]
6
+ params_optional = [param for param in func['arguments'] if not param['is_required']]
7
+ method_definition += '(self, '
8
+ for param in params_required:
9
+ method_definition += param['name']
10
+ method_definition += ', '
11
+ for param in params_optional:
12
+ method_definition += param['name']
13
+ method_definition += '=None, '
14
+ method_definition = method_definition.rstrip(', ') + '):\n'
15
+ indent += 4
16
+ method_definition += ' ' * indent
17
+ method_definition += '"""' + func['description']
18
+ method_definition += '\n\n' + ' ' * indent
19
+ for param in params_required + params_optional:
20
+ method_definition += ':param ' + DTYPE_MAPPING[param['type'].lower()]
21
+ method_definition += ' ' + param['name'] + ': '
22
+ method_definition += param['description']
23
+ method_definition += '\n' if param['is_required'] else ' (Optional)\n'
24
+ method_definition += ' ' * indent
25
+ open_index = func['returns'].find('(')
26
+ close_index = func['returns'].find(')', open_index if open_index > -1 else 0)
27
+ func['returns'] = func['returns'].replace('\t', ' ' * 4)
28
+ return_string = func['returns'].replace('\n', '')
29
+ if open_index < close_index and func['returns'][open_index + 1:close_index] in DTYPE_MAPPING:
30
+ method_definition += ':rtype: ' + DTYPE_MAPPING[func['returns'][open_index + 1:close_index]]
31
+ func['returns'] = func['returns'].replace(func['returns'][open_index:close_index + 1], '')
32
+ method_definition += '\n' + ' ' * indent
33
+ method_definition += ':return: ' + return_string
34
+ for i in range(0, len(return_string) + 1, 80 - (indent + 2)):
35
+ method_definition += return_string[i:i + (80 - (indent + 2))] + '\n' + ' ' * indent
36
+ method_definition += '"""' + '\n' + ' ' * indent
37
+ params_map = '__params_map = {'
38
+ params_indent, num_params = (len(params_map), len(params_required) + len(params_optional))
39
+ method_definition += params_map
40
+ for i, param in enumerate(params_required + params_optional):
41
+ method_definition += "'" + param['name'] + "': " + param['name']
42
+ if not param['is_required']:
43
+ method_definition + ' if ' + param['name'] + 'is not None else None'
44
+ method_definition += ',\n' + ' ' * indent + ' ' * params_indent if i + 1 < num_params else ''
45
+ method_definition += '}\n\n' + ' ' * indent
46
+ method_definition += "return self.make_request(SERVER_ADDRESS, '" + func['name'] + "', " + params_map.rstrip(' = {') + ', timeout=self.timeout)\n\n'
47
+ return method_definition
benchmarks/csn-3.12-licensed/src/00594.py ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ def get_status_key(self, instance):
2
+ """pass"""
3
+ key_id = 'inst_%s' % id(instance) if instance.pk is None else instance.pk
4
+ return '%s.%s-%s-%s' % (instance._meta.app_label, get_model_name(instance), key_id, self.field.name)
benchmarks/csn-3.12-licensed/src/00595.py ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ def get_status(self, instance):
2
+ """pass"""
3
+ status_key, status = self._get_status(instance)
4
+ if status['state'] in ['complete', 'error']:
5
+ cache.delete(status_key)
6
+ return status