query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Return a property setter/getter pair, either from a "real" property get/set pair, or a "virtual" property like "red_enabled" or "cyan_intensity".
def _get_getter_setter(self, prop): if hasattr(self, 'set_'+prop): return getattr(self, 'get_'+prop), getattr(self, 'set_'+prop) else: lamp_name, lamp_prop = prop.rsplit('_', 1) if lamp_name not in self._available_lamps: raise ValueError('Invalid lamp ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Property(name):\n\n attr_name = \"__\" + name\n\n def get(self):\n try:\n return self.__dict__[attr_name]\n except KeyError:\n raise AttributeError, name\n\n def set(self, value):\n if attr_name not in self.__dict__ \\\n or self.__dict__[attr_name] ...
[ "0.6777496", "0.6488281", "0.6468719", "0.6371053", "0.62944317", "0.62325764", "0.61520195", "0.6063008", "0.605303", "0.5963396", "0.5923303", "0.5914463", "0.5900428", "0.5866823", "0.58495504", "0.58495504", "0.57912683", "0.5725679", "0.5702438", "0.56925863", "0.568346"...
0.661035
1
Set a number of parameters at once using keyword arguments, while saving the old values of those parameters. (See lamps() for a description of valid parameters.) pop_state() will restore those previous values. push_state/pop_state pairs can be nested arbitrarily.
def push_state(self, **lamp_parameters): # Also note that we do not filter out identical states from being pushed. # Since the enabled state can be fiddled with IOTool, there is good reason # for pushing an enabled state identical to the current one, so that it # will be restored after a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __setstate__(self, state):\n if len(state) != 1:\n raise TypeError('Invalid state length, expected 1; received %i' %\n len(state))\n kwargs = state[0]\n if not isinstance(kwargs, dict):\n raise TypeError('Key accepts a dict of keyword arguments as state; '\n ...
[ "0.6715735", "0.6636853", "0.6192533", "0.59777206", "0.5968728", "0.58457434", "0.5819592", "0.56664634", "0.5593973", "0.5544398", "0.5472484", "0.54617786", "0.54078764", "0.54078764", "0.53941566", "0.5388684", "0.53712696", "0.53363043", "0.5308082", "0.5276086", "0.5271...
0.61743826
3
Produce a command that switches the green/yellow paddle to the green filter position.
def _iotool_enable_green_command(self): return self._iotool.commands.set_high(self._spconfig.IOTOOL_GREEN_YELLOW_SWITCH_PIN)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_green(self,command):\n if \"on\" in command:\n print 'Green ON'\n GPIO.output(22,GPIO.HIGH)\n elif \"off\" in command:\n print 'Green OFF'\n GPIO.output(22,GPIO.LOW)\n elif \"flash\" in command:\n print 'Flashing green'\n FlashPin(pin=22,count=5,delay=0.1)\n else:\n...
[ "0.6667252", "0.6028988", "0.6024907", "0.5635577", "0.539456", "0.5389388", "0.52197635", "0.5214792", "0.5152538", "0.51346695", "0.50763196", "0.5059358", "0.50518", "0.50459635", "0.50299966", "0.5006441", "0.5004159", "0.49799615", "0.4970993", "0.4952227", "0.49450052",...
0.6651339
1
Produce a command that switches the green/yellow paddle to the yellow filter position.
def _iotool_enable_yellow_command(self): return self._iotool.commands.set_low(self._spconfig.IOTOOL_GREEN_YELLOW_SWITCH_PIN)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _iotool_enable_green_command(self):\n return self._iotool.commands.set_high(self._spconfig.IOTOOL_GREEN_YELLOW_SWITCH_PIN)", "def do_green(self,command):\n if \"on\" in command:\n print 'Green ON'\n GPIO.output(22,GPIO.HIGH)\n elif \"off\" in command:\n print 'Green OFF'\n GP...
[ "0.66017234", "0.6463711", "0.6408746", "0.576167", "0.5699568", "0.5610469", "0.52996385", "0.528892", "0.52802473", "0.52086544", "0.5200548", "0.5187345", "0.5174531", "0.51482487", "0.5146435", "0.51361644", "0.5129312", "0.50764745", "0.50689256", "0.5049614", "0.5039266...
0.6588561
1
'position' should be either 'green' or 'yellow' to insert the corresponding excitation filter into the green/yellow beam.
def set_green_yellow_filter(self, position): if position not in {'green', 'yellow'}: raise ValueError('"position" parameter must be either "green" or "yellow"') if position == 'green': self._iotool.execute(self._iotool_enable_green_command()) else: self._iotoo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_synthetic_more_positions():\n background = Image.new('RGB', (100, 50))\n patch = Image.new('RGB', (10, 10))\n positions = [\n [5, 5],\n [9, 5]\n ]\n\n parameters = {\n 'data': [background, patch],\n 'positions': positions\n }\n\n images.synthetic(parameters...
[ "0.53531677", "0.5220632", "0.5194332", "0.5193839", "0.51745796", "0.4996859", "0.48552203", "0.48219103", "0.48006073", "0.47713152", "0.4769842", "0.47544366", "0.47400308", "0.4717013", "0.47052014", "0.4670778", "0.4665777", "0.46621022", "0.46432894", "0.46413597", "0.4...
0.63949525
0
Returns set of TTL signals the Spectra III is receiving
def get_ttls_active(self): values = self.send_command('GET MULCHTTL') return {lamp: bool(int(value)) for lamp, value in zip(self._LAMP_NAMES, values)}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parseTTL(self):\n rep = ''\n lastChannels = numpy.zeros(self.channelTotal)\n powerArray = 2**numpy.arange(self.channelTotal, dtype = numpy.uint64)\n for key,newChannels in sorted(self.switchingTimes.iteritems()):\n channels = lastChannels + newChannels #computes the actio...
[ "0.56724197", "0.5434014", "0.53288895", "0.5321144", "0.5158706", "0.511819", "0.5099043", "0.5087247", "0.5086027", "0.5086027", "0.5086027", "0.50801307", "0.5051268", "0.5042244", "0.50406134", "0.50191116", "0.5014939", "0.5000203", "0.49590626", "0.49178615", "0.4903553...
0.5032503
15
Determine if the input year is a leapyear. A leapyear has an extra day in February.
def isLeapYear(year): if (year % 4 == 0): if (str(year)[-2:] == "00" and year % 400 != 0): return False return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_leap_year():", "def leapyear(year):\n\n # Return the answer\n return bool(calendar.isleap(year))", "def is_leap_year(year):\n mod = divider(year)\n return mod(4) and not mod(100) or mod(400)", "def is_leap(year):\n\n\n\n\n\n\n\n\n\n\n\treturn year % 4 == 0 and (year % 100 != 0 or year % 40...
[ "0.86802614", "0.8505601", "0.85016274", "0.84771603", "0.84755814", "0.8445686", "0.844222", "0.8434306", "0.84282297", "0.8419743", "0.8396667", "0.83965", "0.8393182", "0.8387692", "0.8384335", "0.8384335", "0.8368348", "0.8365362", "0.83563066", "0.8354779", "0.8353698", ...
0.79595786
56
Initializer method Raises exception if date is invalid. This may be due to the day exceeding the maximum number of days in the given month, or February 29 is specified on a nonLeap Year, etc.
def __init__(self, year=1900, month=1, day=1): # ensure the inputs are parsed into integers year = int(year) month = int(month) day = int(day) # if the year is not from 0000 to 9999 if not (0 <= year and year <= 9999): raise Exception("Year must be between 000...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate(year, month, day):\n if day is not None and month is None:\n raise ValueError(\"Day without month\")\n if day is None:\n day = 1\n if month is None:\n month = 1\n if year is None:\n year = 2000\n # actual validation happen...
[ "0.76030535", "0.7002074", "0.6673425", "0.6647609", "0.65993536", "0.63706475", "0.6331436", "0.6283567", "0.62462884", "0.6236522", "0.6227877", "0.6186614", "0.6181855", "0.6148485", "0.6121073", "0.6105989", "0.6061786", "0.60375345", "0.6025827", "0.59781796", "0.5962233...
0.72118706
1
Return string representation of the date in the format YYYYMMDD.
def __str__(self): # year, formatted unambiguously as YYYY, padded with zeros if not # four-digit yearString = "0" * (4 - len(str(self.get_year())) ) + str(self.get_year()) # month, formatted unambiguously as MM, padded with zeros if not # two-digit ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def date_string(date):\n day = date.day\n month = date.month\n year = date.year\n formatted_string = str(month) + \"/\"\n formatted_string += str(day) + \"/\"\n formatted_string += str(year)\n return formatted_string", "def date_to_final_str(date_obj: datetime) -> str:\n return date_o...
[ "0.7660189", "0.75144106", "0.74433655", "0.742128", "0.7315453", "0.7315453", "0.7257465", "0.7158602", "0.7029121", "0.7015154", "0.6990911", "0.6990911", "0.6988908", "0.69664764", "0.696561", "0.6931559", "0.68857795", "0.6883072", "0.6860537", "0.6855554", "0.68550855", ...
0.7288755
6
Find the weekday of a given date in the format YYYYMMDD. Based on the fact that 19000101 (January 1st, 1900) is a Monday.
def get_weekday(self): originDate = Date(1900, 1, 1) return WEEKDAYS[originDate.days_since(self) % 7]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def date_to_day_of_week(date):\n return date.weekday()", "def date_day_of_week(date):\n day_of_week = date.strftime('%A')\n return day_of_week", "def get_weekday_number(date):\n return date.strftime('%w')", "def weekday(day):\n return (day % 7) - 1", "def date_to_dow(y, m, d):\r\n # Pytho...
[ "0.79289037", "0.7525783", "0.7473712", "0.7228356", "0.71577805", "0.71342295", "0.69331586", "0.69233423", "0.68961066", "0.6864791", "0.6850744", "0.68353283", "0.6816991", "0.674595", "0.66628045", "0.66424584", "0.655923", "0.65518755", "0.65094805", "0.64937097", "0.647...
0.65215534
18
Given another date, find out how many days passed since this date.
def days_since(self, otherDate): # initialize days passed days = 0 # time difference of the year yearDiff = otherDate.get_year() - self.get_year() days += yearDiff * 365 # if other date is in the future, traverse forwards otherwise go # backwards if yearDi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def datediff_today(date):\n today = datetime.date.today()\n datediff = (today - date).days\n return datediff", "def diff_dates(date1, date2):\n\n return abs(date2 - date1).days", "def _get_number_of_days(self, date_from, date_to):\n\n DATETIME_FORMAT = \"%Y-%m-%d %H:%M:%S\"\n from_dt ...
[ "0.7271025", "0.71568805", "0.69931793", "0.687202", "0.6865785", "0.68303543", "0.6826376", "0.68105143", "0.6737072", "0.67137754", "0.6684774", "0.6589549", "0.6587052", "0.6512795", "0.65027285", "0.647871", "0.64774734", "0.6458868", "0.64533335", "0.6426467", "0.6415163...
0.7558373
0
Add lib as primary libraries directory
def setSysPath(): c = os.path.abspath(os.path.dirname(__file__)) add = [ ['lib'], ] for item in add: p = os.path.join(c, *item) if not p in sys.path: sys.path[1:1] = [p] remove = ['django', 'simplejson'] # Remove unwanted paths for item in sys.path: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initLibPath():\n libHash = {\n 'Framework': 1,\n 'UserControlleLib': 1,\n 'CaseLib': 1\n }\n\n binPath = os.path.split(os.path.realpath(__file__))[0]\n\n for key in libHash:\n sys.path.append(os.path.join(__getLibAbsPath(binPath, libHash[key]), key))", "def library_dir...
[ "0.7499683", "0.7174301", "0.7161401", "0.7056918", "0.6999705", "0.67080486", "0.6683748", "0.6609897", "0.6544341", "0.64465064", "0.64386153", "0.6435282", "0.633057", "0.6327534", "0.6266964", "0.623527", "0.62077504", "0.6189101", "0.61389035", "0.61296844", "0.6102648",...
0.6204175
17
Cache this on the request object
def getEngine(conn_string=None, conn_parameters=None, req=None): global engine if engine is None: registry = getUtility(IRegistry) if conn_string is None: conn_string = config.get("audit-connection-string", None) if conn_string is None: conn_string = registry[ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_cache(self):\n return self._request_cache", "def __request__(self) -> requests.Request:\n return self._self_response.request", "def __init__(self, request=None, *args, **kwargs):\n self.request = request\n self.user_cache = None\n super().__init__(*args, **kwargs)...
[ "0.7034484", "0.6443492", "0.64108914", "0.6362529", "0.6360164", "0.6225441", "0.6192814", "0.6139834", "0.61016804", "0.60933745", "0.6093151", "0.60927874", "0.60853124", "0.6077038", "0.60122645", "0.6001718", "0.59988225", "0.5992933", "0.5987393", "0.59583753", "0.59519...
0.0
-1
same, cache on request object
def getSession(conn_string=None, req=None): global engine, session_factory if engine is None: engine = getEngine(conn_string) if session_factory is None: session_factory = scoped_session(sessionmaker(bind=engine)) session = session_factory() return session
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_cache(self):\n return self._request_cache", "def _stash_request_info(request, subject_id, method, version):\n request.environ['api.cache.subject_id'] = subject_id\n request.environ['api.cache.method'] = method\n request.environ['api.cache.version'] = version", "def _get_...
[ "0.6987318", "0.677164", "0.67064637", "0.66762996", "0.648721", "0.6465159", "0.6436197", "0.63755465", "0.6334696", "0.63250595", "0.63072246", "0.6266479", "0.619506", "0.61946285", "0.61839366", "0.61677", "0.6158422", "0.6149883", "0.61326545", "0.6113767", "0.6089935", ...
0.0
-1
Test basic ``host_str`` parsing; no surprises
def test_parse_host_str(self, host_str, expected, expected_tls_dict, ): out = client_kwargs_from_config(host_str) out_tls = out.pop('tls', {}) try: out_tls = out_tls.__dic...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_host(self):\n pass", "def test_parse_url_lowercase_host() -> None:\n assert indieauth._parse_url(\"http://ex.com/hello\").path == \"/hello\"\n assert indieauth._parse_url(\"http://EX.COM/hello\").hostname == \"ex.com\"\n\n parts = indieauth._parse_url(\"http://EX.COM:123/HELLO\")\n ...
[ "0.71296555", "0.7004411", "0.6710971", "0.6688106", "0.6684157", "0.66836333", "0.66433156", "0.65940166", "0.6588238", "0.65803725", "0.65153784", "0.64709073", "0.6464598", "0.6449479", "0.6441863", "0.6395573", "0.63726616", "0.63305074", "0.6261786", "0.6249969", "0.6230...
0.7255004
0
Test setting all certificates
def test_parse_host_str_certs(self, tmpdir): tmpdir.join('cert.pem').ensure() tmpdir.join('key.pem').ensure() tmpdir.join('ca.pem').ensure() out = client_kwargs_from_config( 'http://l cert_path=%s' % tmpdir.strpath ) assert out['tls'].cert == ( t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_cert(self):\n\n try:\n client = SSLClient(host=FQDN, ip=APPLIANCE, usercert=CERT, sslverifyhost=True, cabundle=CABUNDLE)\n self.assertTrue(1==1, \"SSLClient connects with cabundle\")\n except Exception as exception:\n print(exception)\n self.fail(\...
[ "0.68454224", "0.6839459", "0.6586251", "0.64487875", "0.6388208", "0.63583905", "0.6348918", "0.6329575", "0.63064253", "0.62972486", "0.6227047", "0.6139929", "0.60513175", "0.60480106", "0.6001762", "0.5997378", "0.5941374", "0.5921711", "0.588131", "0.5851199", "0.5820473...
0.5487967
50
Test that ``verify=no`` overrides ``cert_path``
def test_no_verify_no_ca(self, host_str_fs, tmpdir): tmpdir.join('cert.pem').ensure() tmpdir.join('key.pem').ensure() tmpdir.join('ca.pem').ensure() out = client_kwargs_from_config( host_str_fs.format(cert_path=tmpdir.strpath), ) assert out['tls'].cert == ( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_fallback_default_verify_paths(self, monkeypatch):\n context = Context(SSLv23_METHOD)\n monkeypatch.setattr(\n _lib, \"SSL_CTX_set_default_verify_paths\", lambda x: 1\n )\n monkeypatch.setattr(\n SSL,\n \"_CRYPTOGRAPHY_MANYLINUX_CA_FILE\",\n ...
[ "0.75012845", "0.72467285", "0.70869243", "0.6916627", "0.6636409", "0.66044754", "0.6463585", "0.63147724", "0.62792575", "0.6222937", "0.6192983", "0.61852807", "0.6139677", "0.61195046", "0.60851365", "0.6025279", "0.60072756", "0.59979486", "0.5995647", "0.59738326", "0.5...
0.7373964
1
Test raising ``TLSParameterError`` when certs don't exist
def test_certs_error(self, tmpdir): with pytest.raises(docker.errors.TLSParameterError): client_kwargs_from_config( 'http://l cert_path=%s' % tmpdir.strpath )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_use_certificate_wrong_args(self, ctx_or_conn):\n with pytest.raises(TypeError):\n ctx_or_conn.use_certificate(\"hello, world\")", "def test_use_certificate_uninitialized(self, ctx_or_conn):\n with pytest.raises(Error):\n ctx_or_conn.use_certificate(X509())", "def te...
[ "0.72817093", "0.70087916", "0.6903538", "0.6889311", "0.6868677", "0.68513125", "0.68279433", "0.6764401", "0.6663912", "0.66038126", "0.6587073", "0.6454101", "0.6369873", "0.6354723", "0.6334118", "0.63293386", "0.6291678", "0.6207184", "0.6188143", "0.61739486", "0.616070...
0.7826428
0
Ensure that when client cert/key exists, but the CA doesn't, cert params are set without verify
def test_no_ca_no_error(self, tmpdir): tmpdir.join('cert.pem').ensure() tmpdir.join('key.pem').ensure() out = client_kwargs_from_config( 'http://l cert_path=%s' % tmpdir.strpath ) assert out['tls'].cert == ( tmpdir.join('cert.pem').strpath, t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_no_verify_no_ca(self, host_str_fs, tmpdir):\n tmpdir.join('cert.pem').ensure()\n tmpdir.join('key.pem').ensure()\n tmpdir.join('ca.pem').ensure()\n\n out = client_kwargs_from_config(\n host_str_fs.format(cert_path=tmpdir.strpath),\n )\n\n assert out['tl...
[ "0.7238679", "0.6843561", "0.66534835", "0.6623861", "0.65620136", "0.65516835", "0.65445775", "0.6510549", "0.6388831", "0.6363554", "0.6320691", "0.6276618", "0.62438065", "0.6237401", "0.62106156", "0.6189989", "0.61834127", "0.61439455", "0.6106423", "0.6105602", "0.60965...
0.7384116
0
Test getting ref name when single commit on master
def test_master(self, tmpgitdir, branch): with tmpgitdir.join('file_a.txt').open('w') as handle: handle.write('first file') subprocess.check_call(['git', 'checkout', '-b', branch]) subprocess.check_call(['git', 'add', '.']) subprocess.check_call(['git', 'commit', '-m', 'firs...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_branch_name_get(repository: Repository) -> None:\n branch = repository.branch(repository.head.name)\n assert repository.head.name == branch.name", "def test_head_name(repository: Repository) -> None:\n head = repository._repository.references[\"HEAD\"]\n name = head.target.removeprefix(\"ref...
[ "0.7019529", "0.67915136", "0.6760462", "0.6728467", "0.6610641", "0.656851", "0.6391419", "0.63680166", "0.6335848", "0.6233286", "0.62091017", "0.6200208", "0.6198456", "0.6154646", "0.61292136", "0.61259127", "0.6123044", "0.6099713", "0.6078296", "0.60608035", "0.59980595...
0.60457766
20
Test when branch is not master
def test_multiple_branches(self, tmpgitdir): with tmpgitdir.join('file_a.txt').open('w') as handle: handle.write('first file') subprocess.check_call(['git', 'add', '.']) subprocess.check_call(['git', 'commit', '-m', 'first']) subprocess.check_call(['git', 'checkout', '-b', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_default_repo_branch(self):\n # network may be unavailable, but we are not interested anyway,\n # so we ignore the exitcode\n output = self.run_command(\"selfupdate --check\", exitcode=None)\n self.assertIn(\"Target: ywangd:master\", output)\n self.assertNotIn(\"Target: y...
[ "0.74963045", "0.7121406", "0.68485004", "0.68422204", "0.6797293", "0.67708224", "0.66588646", "0.65996534", "0.65641767", "0.6491489", "0.6479997", "0.64630324", "0.636714", "0.6359062", "0.63192993", "0.63192993", "0.6304544", "0.62983483", "0.6282403", "0.6232887", "0.622...
0.0
-1
Test when a git commit is made, tagged, then described by it's tag
def test_tagged(self, tmpgitdir, branch): with tmpgitdir.join('file_a.txt').open('w') as handle: handle.write('first file') subprocess.check_call(['git', 'checkout', '-b', branch]) subprocess.check_call(['git', 'add', '.']) subprocess.check_call(['git', 'commit', '-m', 'firs...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_git_commits(self):\n event_id = dog.Event.create(title=\"Testing git commits\", text=\"\"\"$$$\n eac54655 * Merge pull request #2 from DataDog/alq-add-arg-validation (alq@datadoghq.com)\n |\\\n 760735ef | * origin/alq-add-arg-validation Simple typecheck between me...
[ "0.71023124", "0.68768877", "0.66216725", "0.65907145", "0.6243646", "0.62270266", "0.6220564", "0.6176081", "0.6136612", "0.61345124", "0.61071676", "0.6001234", "0.5948178", "0.5940225", "0.59256774", "0.5903266", "0.58939385", "0.5875933", "0.5875386", "0.5869599", "0.5838...
0.69506216
1
Test when in a detached head state
def test_detached_head(self, tmpgitdir, branch): with tmpgitdir.join('file_a.txt').open('w') as handle: handle.write('first file') subprocess.check_call(['git', 'checkout', '-b', branch]) subprocess.check_call(['git', 'add', '.']) subprocess.check_call(['git', 'commit', '-m'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_head_detached(repository: Repository) -> None:\n repository._repository.set_head(repository.head.commit.id)\n with pytest.raises(ValueError):\n repository.head", "def on_detached(reason, crash):\n print(\"on_detached()\")\n print(\"reason:\", reason)\n print...
[ "0.62961733", "0.5902365", "0.588763", "0.581806", "0.57294714", "0.5610439", "0.5524324", "0.5491706", "0.548161", "0.54555845", "0.5435171", "0.53663003", "0.53559685", "0.5302321", "0.5245934", "0.5240968", "0.52279854", "0.5223066", "0.52176344", "0.5216953", "0.52143174"...
0.6109551
1
Test when in a detached head state, where the commit is tagged
def test_tagged_detached_head(self, tmpgitdir, branch): with tmpgitdir.join('file_a.txt').open('w') as handle: handle.write('first file') subprocess.check_call(['git', 'checkout', '-b', branch]) subprocess.check_call(['git', 'add', '.']) subprocess.check_call(['git', 'commit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_detached_head(tmpdir):\n repo = Repo.init(path=tmpdir)\n tmppath = pathlib.Path(tmpdir)\n\n index = repo.index\n author = Actor(\"An author\", \"author@example.com\")\n committer = Actor(\"A committer\", \"committer@example.com\")\n\n # First commit\n with open(tmppath / \"test.py\", ...
[ "0.7025714", "0.6931008", "0.69243526", "0.66605234", "0.652574", "0.6475694", "0.6046414", "0.6031785", "0.5926672", "0.5866686", "0.58500826", "0.58421004", "0.5838575", "0.5799745", "0.57833153", "0.5764867", "0.57611847", "0.56860304", "0.5668869", "0.5654756", "0.5649913...
0.7445173
0
Ensure that a commit directly before another is correctly identified as an ancestor, and that the child is identified as not an ancestor
def test_two_commits(self, tmpgitdir): with tmpgitdir.join('file_a.txt').open('w') as handle: handle.write('first file') subprocess.check_call(['git', 'add', '.']) subprocess.check_call(['git', 'commit', '-m', 'first']) first_hash = subprocess.check_output( ['git...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lint_commit_base(commit):\n success = True\n # Merge commits have two parents, we maintain a linear history.\n if len(commit.parents) > 1:\n error(\n \"Please resolve merges by re-basing. Merge commits are not allowed.\",\n commit)\n success = False\n\n return su...
[ "0.64292395", "0.6359155", "0.63076717", "0.6198901", "0.61818206", "0.6159696", "0.61231625", "0.6046435", "0.59505606", "0.5904542", "0.58570373", "0.5819268", "0.5811302", "0.5809034", "0.57591075", "0.57033724", "0.5699567", "0.56659716", "0.5589706", "0.5573943", "0.5563...
0.5652296
18
This is a method. Methods always set at least one parameter of self to access the instance of the object it is called on.
def x_plus_five(self): # We use "self" to print a given instance's value of x + 5. print(f"x_plus_five called: {self.x + 5}")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _self(self, _self):\n\n self.__self = _self", "def _self(self, _self):\n\n self.__self = _self", "def __call__( self ):\n pass", "def __call__(self):\n return self", "def __call__(self, *args, **kwargs):\n return self", "def on(self, o_self):\r\n self.o_self ...
[ "0.746999", "0.746999", "0.726812", "0.7142138", "0.7049129", "0.6931898", "0.6913924", "0.68489844", "0.68489844", "0.6752757", "0.66931313", "0.66902745", "0.66819245", "0.6673", "0.6662391", "0.6662391", "0.6618171", "0.6583335", "0.65659183", "0.65659183", "0.65603673", ...
0.0
-1
Using the syntax "self.var", where "var" is a given parameter, we can set attributes of a given instantiation of a class during its creation.
def __init__(self, name, color): self.name = name self.color = color
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.some_att = 42", "def __init__(self, **kwargs):\n # loop over the given kwargs\n for key, value in kwargs.items():\n # treat them like attribute assignments\n setattr(self, key, value)", "def __init__(self, **attributes):\n self.set(**...
[ "0.6430677", "0.6402646", "0.6395173", "0.63498294", "0.6280769", "0.62556434", "0.6242347", "0.6198639", "0.61928385", "0.6163288", "0.60201716", "0.60201716", "0.60201716", "0.60201716", "0.60201716", "0.60201716", "0.60201716", "0.60201716", "0.60201716", "0.60201716", "0....
0.0
-1
The 'super()' function is a builtin Python function that allows programmers to access the functionality of a parent class. In this case, the 'super()' function is used to inherit the attributes defined in the 'Person' class.
def __init__(self, first_name, last_name, grad_year): super().__init__(first_name, last_name) self.grad_year = grad_year # The attribute "grad_year" is specific to the "Student" class.
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, \n # - Arguments from Person\n given_name=None, initials=None, family_name=None, \n email_address=None,\n # - Other staff-specific arguments\n department=None\n ):\n # - We can use super() to call the parent class' __init__ \n # because there...
[ "0.6255224", "0.6236259", "0.6073607", "0.6003976", "0.59831387", "0.5904791", "0.5902348", "0.5843934", "0.58347756", "0.5777662", "0.57635736", "0.5706435", "0.5704878", "0.56416774", "0.5620114", "0.5605605", "0.55657464", "0.5556208", "0.5552142", "0.55266005", "0.5485164...
0.59525096
5
Calls hdevtools with the given arguments. Shows a sublime error message if hdevtools is not available.
def call_hdevtools_and_wait(arg_list, filename = None, cabal = None): if not hdevtools_enabled(): log("call_hdevtools_and_wait: hdevtools disabled") return None ghc_opts_args = get_ghc_opts_args(filename, cabal = cabal) hdevtools_socket = get_setting_async('hdevtools_socket') source_dir...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hdevtools_check(filename, cabal = None):\n return call_hdevtools_and_wait(['check', filename], filename = filename, cabal = cabal)", "def hxladd():\n run_script(hxladd_main)", "def load_devtools(self):\n pass", "def run():\n if len(sys.argv)<2:\n sys.argv.append(\"-h\")\n plac.c...
[ "0.63388383", "0.63170105", "0.6034037", "0.5807966", "0.57696307", "0.5757621", "0.5680612", "0.5641825", "0.5575785", "0.55453885", "0.54091835", "0.540879", "0.5359283", "0.5338525", "0.5321896", "0.5259705", "0.52513844", "0.5241204", "0.5224239", "0.52062774", "0.5172954...
0.60009664
3
Uses hdevtools info filename symbol_name to get symbol info
def hdevtools_info(filename, symbol_name, cabal = None): contents = call_hdevtools_and_wait(['info', filename, symbol_name], filename = filename, cabal = cabal) return parse_info(symbol_name, contents) if contents else None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nm(filename):\n binary = parse(filename) # Build an abstract binary\n symbols = binary.symbols\n\n if len(symbols) > 0:\n for symbol in symbols:\n print(symbol)\n else:\n print(\"No symbols found\")", "def symbols_details(self):\n pass", "def get_symbols(doc, li...
[ "0.68157065", "0.6396066", "0.61771023", "0.6132515", "0.6047057", "0.5982517", "0.5970701", "0.59500575", "0.585406", "0.58314234", "0.5776864", "0.5761884", "0.57422334", "0.5717828", "0.56954217", "0.56462055", "0.5640362", "0.56306994", "0.5626244", "0.5619888", "0.561891...
0.80114484
0
Uses hdevtools to check file
def hdevtools_check(filename, cabal = None): return call_hdevtools_and_wait(['check', filename], filename = filename, cabal = cabal)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_and_analyze(self, domain_path, php_info_filename):\n php_info_url = domain_path.url_join(php_info_filename)\n\n response = self._uri_opener.GET(php_info_url,\n cache=True,\n grep=False)\n\n if is_404(respo...
[ "0.5883917", "0.5862428", "0.58590376", "0.5857866", "0.58339536", "0.58069247", "0.578893", "0.57692254", "0.57237095", "0.57019496", "0.5681064", "0.5659866", "0.5608667", "0.5608043", "0.56055325", "0.5588865", "0.55619746", "0.55446285", "0.55349016", "0.55287385", "0.551...
0.7422176
0
Uses hdevtools to infer type
def hdevtools_type(filename, line, column, cabal = None): return call_hdevtools_and_wait(['type', filename, str(line), str(column)], filename = filename, cabal = cabal)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def infer(self):\n # Update ext_type.symtab\n self.type_infer_init_method()\n\n # Type infer the rest of the methods (with fixed attribute table!)\n self.type_infer_methods()", "def test_get_types(self):\n pass", "def get_check_types():", "def _propagate_types(self):\n p...
[ "0.58407456", "0.58132976", "0.5809135", "0.5733886", "0.57151115", "0.5673977", "0.5669237", "0.56227255", "0.561683", "0.5489797", "0.5477508", "0.54729587", "0.54698926", "0.54627055", "0.5419648", "0.54010326", "0.53666264", "0.5364339", "0.5355661", "0.5355128", "0.53074...
0.5939715
0
Construct a WorldfileMultiple command.
def __init__(self, projectDir, configFile=None, outfp=sys.stdout): super(WorldfileMultiple, self).__init__(projectDir, configFile, outfp)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def construct_phyla_plots_cmds(sample_ids, cmd_format, cmd_args):\n commands = []\n for chunk in chunk_list(sample_ids):\n args = cmd_args.copy()\n args['samples'] = ','.join(chunk)\n commands.append(cmd_format % args)\n return commands", "def multi(self, *argv, **kwargs):\n ...
[ "0.5461225", "0.5446993", "0.5372413", "0.5307399", "0.5222449", "0.5203311", "0.5134721", "0.50966644", "0.50889033", "0.5069162", "0.50483453", "0.5005254", "0.50007635", "0.49818003", "0.49678537", "0.49677798", "0.4950114", "0.49232692", "0.49096394", "0.48966783", "0.488...
0.56983197
0
Check to make sure the project directory has the necessary metadata to run this command.
def checkMetadata(self): super(WorldfileMultiple, self).checkMetadata() # Check for necessary information in metadata if not 'basin_rast' in self.grassMetadata: raise MetadataException("Metadata in project directory %s does not contain a basin raster in a GRASS mapset" % (se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_before_run(self):\n\t\tif not osp.exists(self.dataset_dir):\n\t\t\traise RuntimeError(\"'{}' is not available\".format(self.dataset_dir))\n\t\tif not osp.exists(self.train_dir):\n\t\t\traise RuntimeError(\"'{}' is not available\".format(self.train_dir))\n\t\tif not osp.exists(self.query_dir):\n\t\t\trai...
[ "0.65591425", "0.64942133", "0.64942133", "0.64942133", "0.64942133", "0.64942133", "0.64942133", "0.64942133", "0.6445897", "0.6438879", "0.6355895", "0.6309706", "0.6302053", "0.62225735", "0.6220267", "0.61737317", "0.61436486", "0.61220795", "0.61055565", "0.6033032", "0....
0.63320154
11
Multiple worldfiles, one worldfile for each subbasin delineated.
def run(self, *args, **kwargs): verbose = kwargs.get('verbose', False) self.checkMetadata() rhessysDir = self.metadata['rhessys_dir'] self.paths = RHESSysPaths(self.context.projectDir, rhessysDir) templateFilename = os.path.basename(self.metadata['templ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, projectDir, configFile=None, outfp=sys.stdout):\n super(WorldfileMultiple, self).__init__(projectDir, configFile, outfp)", "def createWorlds(worldArray, objArray=None):\n if objArray is None:objArray=pm.ls(sl=1)\n\n worldReturn=[]\n for obj in objArray:\n worldNulls=[]\n...
[ "0.588202", "0.58733183", "0.5627406", "0.55745405", "0.5551754", "0.5435319", "0.537596", "0.53621614", "0.53334093", "0.53283215", "0.53046286", "0.52487224", "0.52483416", "0.52061886", "0.5153927", "0.51413894", "0.5065567", "0.50595194", "0.5052889", "0.5024386", "0.5019...
0.0
-1
clean away the 10% of points that have the largest residual errors (different between the prediction and the actual net worth) return a list of tuples named cleaned_data where each tuple is of the form (age, net_worth, error)
def outlierCleaner(predictions, ages, net_worths): cleaned_data = [] ### your code goes here temp = abs(predictions-net_worths) for k in range(len(ages)): cleaned_data.append((ages[k][0],net_worths[k][0],temp[k][0])) cleaned_data = sorted(cleaned_data, key=lambda data:data[2]) prin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def outlierCleaner(predictions, ages, net_worths):\n\n #cleaned_data = []\n # construct a data list with age, net_worth in place plus one extra param for square error\n data = [(age, net_worth, pred - net_worth) for age, net_worth, pred in zip (ages, net_worths, predictions)]\n sorted_data = sorted(dat...
[ "0.78619015", "0.7675518", "0.7572094", "0.75443864", "0.75393873", "0.75158566", "0.74956214", "0.7415158", "0.73935616", "0.73925316", "0.7362416", "0.7359262", "0.73373353", "0.72750604", "0.72525215", "0.7202793", "0.7199136", "0.71755993", "0.71162784", "0.7111074", "0.6...
0.71157753
19
read_symbols(filename) > SymbolTable read from the binary file
def read_symbols(filename): filename = as_str(filename) cdef ifstream* fstream = new ifstream(filename) cdef SymbolTable table = SymbolTable.__new__(SymbolTable) table.table = sym.SymbolTableRead(fstream[0], filename) del fstream return table
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_symbols(symbols_file_path):\n return np.genfromtxt(symbols_file_path, delimiter=',', dtype=np.str)", "def read_opcode_info(filename):\r\n \r\n # Open file and read it into a list of lines.\r\n fin = open(filename, \"r\")\r\n lines = fin.readlines()\r\n fin.close()\r\n \r\n # We'll ...
[ "0.70136464", "0.6443618", "0.62608534", "0.60250115", "0.59742904", "0.59548825", "0.5942269", "0.59381986", "0.5802325", "0.57955843", "0.57708764", "0.5745995", "0.57382387", "0.56561285", "0.5611826", "0.56110764", "0.55889505", "0.5569072", "0.5523966", "0.55123675", "0....
0.83470607
0
SymbolTable() > new symbol table with \u03b5 0 SymbolTable(epsilon) > new symbol table with epsilon 0
def __init__(self, epsilon=EPSILON): cdef bytes name = 'SymbolTable<{0}>'.format(id(self)).encode('ascii') self.table = new sym.SymbolTable(<string> name) assert (self[epsilon] == EPSILON_ID)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\r\n self.s_table = SymbolTable.preSymbols", "def symbol_table(self, value: str):\n self._symbol_table = value", "def getSymbolTable(self) -> ghidra.app.util.bin.format.pe.debug.DebugCodeViewSymbolTable:\n ...", "def symbols(self):\n pass", "def _create_symbol...
[ "0.6887349", "0.60825706", "0.59769744", "0.59410924", "0.59129506", "0.5899086", "0.58946913", "0.58743674", "0.57885927", "0.5715725", "0.5517328", "0.5511564", "0.5511564", "0.549144", "0.5476111", "0.5462763", "0.53864384", "0.53756225", "0.5362634", "0.5319834", "0.53064...
0.782774
0
table.copy() > copy of the symbol table
def copy(self): cdef SymbolTable result = SymbolTable.__new__(SymbolTable) result.table = new sym.SymbolTable(self.table[0]) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_table(self):\n return copy.deepcopy(self._table)", "def Copy(self, copy):\n return _table.Table_Copy(self, copy)", "def copy(self):\n table = Table()\n for label in self.column_labels:\n self._add_column_and_format(table, label, np.copy(self[label]))\n retu...
[ "0.6492269", "0.6435444", "0.6395961", "0.63327885", "0.6277186", "0.6192845", "0.61332405", "0.613064", "0.59814733", "0.5872732", "0.5858917", "0.58048284", "0.5763351", "0.5747134", "0.5696706", "0.5637006", "0.5603323", "0.5565166", "0.5478365", "0.54699296", "0.54500276"...
0.8015655
0
table.find(int value) > decoded symbol if any symbol maps to this value table.find(str symbol) > encoded value if this symbol is in the table
def find(self, key): if isinstance(key, (int, long)): result = self.table.Find(<long> key).decode('utf8') if result == u'': raise KeyError(key) return result else: key = as_str(key) result = self.table.Find(<char*>key) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lookup(c):\r\n if c not in chars:\r\n return ValueError\r\n p = chars.index(c)\r\n return vals[p]", "def decode_symbol(self, bits):\n return self.bits_to_symbol.get(bits)", "def read_symbol(table, index, br):\n x_bits = br.read_bits(16, 0) # The C reference version assumes 15 is ...
[ "0.5967776", "0.59297276", "0.579121", "0.5785204", "0.57709646", "0.5715084", "0.56764424", "0.56462324", "0.56342566", "0.5632784", "0.55733097", "0.5572284", "0.5543737", "0.553452", "0.5524773", "0.5490346", "0.54811615", "0.5480724", "0.54718745", "0.5465133", "0.5456967...
0.5317585
33
table.items() > iterator over (symbol, value) pairs
def items(self): cdef sym.SymbolTableIterator* it = new sym.SymbolTableIterator(self.table[0]) try: while not it.Done(): yield (it.Symbol().decode('utf8'), it.Value()) it.Next() finally: del it
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __iter__(self) -> Iterator[Tuple[K, List[V]]]:\n return (entry for entry in self._table.items())", "def __iter__(self):\r\n for column, value in self.items():\r\n # this uses __getitem__, using the name (rather than the accessor)\r\n # is correct – it's what __getitem__ ex...
[ "0.6874724", "0.68101335", "0.65793943", "0.6564461", "0.65016985", "0.64539164", "0.637112", "0.6238372", "0.61545885", "0.614661", "0.61349154", "0.60843146", "0.6063622", "0.6063622", "0.6025974", "0.60004103", "0.59667796", "0.59623426", "0.59541434", "0.59279233", "0.591...
0.7380278
0
Merge tables `syms1` and `syms2` into `merged` if they are compatible. Tables are compatible if all common symbol/values map identically.
def _merge_tables(SymbolTable syms1, SymbolTable syms2, SymbolTable merged): for symbol, value in syms1.items(): try: other_symbol = syms2.find(value) if other_symbol != symbol: raise ValueError('incompatible symbol tables') except KeyError: pass ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_fs(fs1,fs2):\n # This function merges fs2 into fs1, changing fs1 in-place\n # It's a cheaper and faster alternative of unify(), which will check\n # all the similarities and differences between fs1 and fs2. But this one\n # just assumes that fs2 and fs1 does not have any entries in common\n ...
[ "0.601715", "0.5610678", "0.5535604", "0.5451038", "0.5331601", "0.53010577", "0.5196176", "0.51377356", "0.5095105", "0.5080329", "0.5064888", "0.50560766", "0.50427425", "0.50423485", "0.50400716", "0.49894622", "0.49616647", "0.49493426", "0.49420464", "0.4935286", "0.4889...
0.8205983
0
TropicalWeight(value) > tropical weight initialized with the given value
def __init__(self, value): if value is True or value is None: self.weight = new openfst.TropicalWeight(openfst.TropicalWeightOne()) elif value is False: self.weight = new openfst.TropicalWeight(openfst.TropicalWeightZero()) else: self.weight = new openfst.Trop...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_tb_tb_weights(weight=1.):\r\n W = np.zeros([8, 8])\r\n sinusoid = -(np.cos(np.linspace(0, 2 * np.pi, 8, endpoint=False)) - 1) / 2\r\n for i in range(8):\r\n values = np.roll(sinusoid, i)\r\n W[i, :] = values\r\n return weight * W", "def get_weight(self):\n pass", "def g...
[ "0.65349126", "0.6164336", "0.6164336", "0.6140293", "0.6139442", "0.61315674", "0.61213374", "0.6033982", "0.6022765", "0.60090303", "0.59763247", "0.59763247", "0.59679335", "0.5965371", "0.59355384", "0.59238636", "0.5918259", "0.5911267", "0.58945274", "0.58842987", "0.58...
0.6796364
0
A StdVectorFst arc (with a tropical weight)
def __init__(self): raise NotImplementedError('cannot create independent arc')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetArc(arc):\r\n pass", "def arc(r, mv_direction):\n \n vert_amount = 80\n arc_vert_amount = int(vert_amount / 2);\n edge = 2 * r * math.sin(math.radians(360 / (2 * vert_amount)))\n polygon_angle = (vert_amount - 2) / vert_amount * 180\n angle = 180 - polygon_angle\n \n for i i...
[ "0.59507215", "0.56464434", "0.5621576", "0.5582629", "0.55555063", "0.5539467", "0.5521051", "0.55084366", "0.5399608", "0.5391588", "0.53687686", "0.5368456", "0.53506905", "0.5302483", "0.529153", "0.52848893", "0.52689445", "0.52663344", "0.5260531", "0.5239022", "0.52300...
0.5459789
8
A StdVectorFst state (with StdArc arcs)
def __init__(self): raise NotImplementedError('cannot create independent state')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy(self):\n cdef StdVectorFst result = StdVectorFst.__new__(StdVectorFst)\n if self.isyms is not None:\n result.isyms = self.isyms.copy()\n if self.osyms is not None:\n result.osyms = (result.isyms if (self.isyms is self.osyms)\n else self.osyms.copy(...
[ "0.6104697", "0.5815882", "0.5764689", "0.5555627", "0.54482514", "0.5442319", "0.5415849", "0.54098356", "0.539673", "0.5251519", "0.51693547", "0.5139526", "0.5108899", "0.50206167", "0.5016088", "0.50008273", "0.49826655", "0.49693358", "0.49244115", "0.49211946", "0.49189...
0.0
-1
StdVectorFst(isyms=None, osyms=None) > empty finitestate transducer StdVectorFst(source) > copy of the source transducer
def __init__(self, source=None, isyms=None, osyms=None): if isinstance(source, StdVectorFst): self.fst = <openfst.StdVectorFst*> self.fst.Copy() else: self.fst = new openfst.StdVectorFst() # todo: implement LogVectorFst. #if isinstance(source, LogVectorFst...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy(self):\n cdef StdVectorFst result = StdVectorFst.__new__(StdVectorFst)\n if self.isyms is not None:\n result.isyms = self.isyms.copy()\n if self.osyms is not None:\n result.osyms = (result.isyms if (self.isyms is self.osyms)\n else self.osyms.copy(...
[ "0.6920192", "0.62388426", "0.5871237", "0.57356966", "0.5718539", "0.5653314", "0.5335162", "0.5119913", "0.5045772", "0.49676844", "0.47438803", "0.47279066", "0.46557736", "0.46314356", "0.46143156", "0.4575382", "0.4566534", "0.45189705", "0.44923723", "0.44423857", "0.44...
0.69025594
1
fst.num_arcs() > total number of arcs in the transducer
def num_arcs(self): return sum(len(state) for state in self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_arcs(self):\n return len(self.arcs)", "def get_num_arcs(self):\n num_arcs = 0\n for node in self._nodes.values(): num_arcs += node._deg\n return (num_arcs / 2) + 1", "def get_num_arcs(self):\n num_arcs = 0\n for node in self._nodes.values(): num_arcs += node._d...
[ "0.6503137", "0.5390219", "0.5390219", "0.5311139", "0.53066105", "0.52582544", "0.51249367", "0.51127076", "0.5084829", "0.50745136", "0.50736403", "0.5000744", "0.5000361", "0.49896824", "0.49630937", "0.49618727", "0.48941165", "0.4880546", "0.4877309", "0.48604143", "0.48...
0.6417278
1
fst.copy() > a copy of the transducer
def copy(self): cdef StdVectorFst result = StdVectorFst.__new__(StdVectorFst) if self.isyms is not None: result.isyms = self.isyms.copy() if self.osyms is not None: result.osyms = (result.isyms if (self.isyms is self.osyms) else self.osyms.copy()) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy(self):\n return SparseN(self)", "def copy(self):", "def copy(tensor):\n raise NotImplementedError", "def copy_previous_sample(self):\n self.context[self.iter] = self.context[self.iter-1]\n self.beta[self.iter] = self.beta[self.iter-1]", "def _use_copy(self):\n se...
[ "0.5807821", "0.57013446", "0.5697668", "0.5683617", "0.5560055", "0.5510678", "0.54720306", "0.54429615", "0.5433057", "0.5402452", "0.5401653", "0.5347488", "0.53439814", "0.53389823", "0.53324836", "0.5322118", "0.5313025", "0.53110033", "0.530622", "0.5291283", "0.5290641...
0.56956756
3
fst.add_arc(int source, int dest, int ilabel, int olabel, weight=None)
def add_arc(self, int source, int dest, int ilabel, int olabel, weight=None): if source > self.fst.NumStates()-1: raise ValueError('invalid source state id ({0} > {1})'.format(source, self.fst.NumStates()-1)) if dest > self.fst.NumStates()-1: raise ValueError('inv...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_arc(rule_fst, index, token, nonterminal_coverages, weight=None):\n\n # Add arc of the form epsilon:token\n\n # Nonterminal symbol\n if token in nonterminal_coverages:\n rule_fst.add_arc(index, index + 1, 0, int(nonterminal_coverages[token]))\n\n elif int(token) == Ope...
[ "0.69422287", "0.6696642", "0.64102465", "0.6044187", "0.585226", "0.58391315", "0.57758266", "0.5771317", "0.57682467", "0.57481164", "0.56878084", "0.56331134", "0.5566571", "0.5551789", "0.5551048", "0.552699", "0.55259097", "0.5471207", "0.54608434", "0.5456122", "0.54319...
0.8584377
0
fst.add_state() > new state
def add_state(self): return self.fst.AddState()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put(cls, new_state: TState) -> \"State[Tuple, TState]\":\n return State(lambda state: (Unit, new_state))", "def set_state(self, new_state):\n if self.state_size != len(new_state):\n raise()\n \n self.index = 0\n self.mt = [0] * self.state_size\n \n ...
[ "0.72844535", "0.6810779", "0.66312695", "0.65882593", "0.6583458", "0.6462981", "0.64470166", "0.64100325", "0.63604087", "0.63312083", "0.6286474", "0.62414885", "0.62280333", "0.6183359", "0.6148567", "0.614787", "0.613842", "0.6137333", "0.61278456", "0.61263424", "0.6094...
0.8028894
0
fst.determinize() > determinized transducer
def determinize(self): cdef StdVectorFst result = StdVectorFst(isyms=self.isyms, osyms=self.osyms) openfst.Determinize(self.fst[0], result.fst) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def determinize(A):\n A = epsilon_remove(A)\n subset2state = {frozenset({0}): 0}\n state2subset = {0: frozenset({0})}\n\n alphabet = A.alphabet\n\n B = Automaton(1, set())\n\n if 0 in A.accepting:\n B.accepting.add(0)\n \n frontier = {0}\n while len(frontier) > 0:\n new_fro...
[ "0.5419944", "0.53823406", "0.53585374", "0.5134222", "0.5114933", "0.5071433", "0.5023954", "0.5011669", "0.49769273", "0.49137333", "0.48699903", "0.48521927", "0.48403203", "0.48399127", "0.4822672", "0.48219958", "0.481958", "0.48166376", "0.481023", "0.480491", "0.480353...
0.63501775
0
fst.compose(StdVectorFst other) > composed transducer
def compose(self, StdVectorFst other): if (self.osyms or other.isyms) and (self.osyms != other.isyms): raise ValueError('transducer symbol tables are not compatible for composition') cdef StdVectorFst result = StdVectorFst(isyms=self.isyms, osyms=other.osyms) openfst.Compose(self.fst...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def into(target, xducer, coll):\n return transduce(xducer, append, target, coll)", "def compose(a,b,shape_factor=None):\n\tif isinstance(a,Dense.denseAD) and (isinstance(b,Sparse.spAD) or all(isinstance(e,Sparse.spAD) for e in b)):\n\t\telem = None\n\t\tsize_factor = np.prod(shape_factor)\n\t\tif shape_factor...
[ "0.5957253", "0.5651029", "0.564393", "0.56030774", "0.5564454", "0.5412876", "0.5410412", "0.53948104", "0.53605056", "0.53134406", "0.5311556", "0.5243856", "0.5236318", "0.5185403", "0.5152642", "0.5138685", "0.5131285", "0.513073", "0.50922656", "0.5081686", "0.50802356",...
0.76929843
0
fst.intersect(StdVectorFst other) > intersection of the two acceptors
def intersect(self, StdVectorFst other): if not (self.acceptor and other.acceptor): raise ValueError('both transducers need to be acceptors for intersection') # TODO check and merge symbol tables (intersection) if self.isyms and (self.isyms != other.isyms): raise ValueErr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def intersection(st, ave):\n return (st+ave)*(st+ave+1)//2 + ave", "def intersection(st, ave):\n return (st+ave)*(st+ave+1)//2 + ave", "def intersection(st, ave):\n return (st+ave)*(st+ave+1)//2 + ave", "def intersection(st, ave):\n return (st+ave)*(st+ave+1)//2 + ave", "def intersection(st, av...
[ "0.7009266", "0.7009266", "0.7009266", "0.7009266", "0.7009266", "0.7006973", "0.6933211", "0.66707516", "0.6646042", "0.66373456", "0.66121304", "0.6597997", "0.65473455", "0.65094155", "0.64364016", "0.63134086", "0.63125205", "0.6276214", "0.6265396", "0.6218907", "0.62164...
0.7845703
0
fst.union(StdVectorFst other) > union of the two transducers
def union(self, StdVectorFst other): cdef StdVectorFst result = self.copy() result.set_union(other) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def union(set1, set2):", "def _union(cls, s1, s2):\n return s1.union(s2)", "def intersect(self, StdVectorFst other):\n if not (self.acceptor and other.acceptor):\n raise ValueError('both transducers need to be acceptors for intersection')\n # TODO check and merge symbol tables (...
[ "0.6959548", "0.6676238", "0.655247", "0.65170395", "0.64780825", "0.64126706", "0.63926506", "0.63912684", "0.6372273", "0.63648283", "0.6319378", "0.6300179", "0.6287052", "0.62588483", "0.625192", "0.62286276", "0.616206", "0.6152447", "0.6104714", "0.6100579", "0.6093492"...
0.77419794
0
fst.concatenation(StdVectorFst other) > concatenation of the two transducers
def concatenation(self, StdVectorFst other): cdef StdVectorFst result = self.copy() result.concatenate(other) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compose(self, StdVectorFst other):\n if (self.osyms or other.isyms) and (self.osyms != other.isyms):\n raise ValueError('transducer symbol tables are not compatible for composition')\n cdef StdVectorFst result = StdVectorFst(isyms=self.isyms, osyms=other.osyms)\n openfst.Compose...
[ "0.69481677", "0.64964294", "0.62441736", "0.61367065", "0.60064864", "0.5919863", "0.58268344", "0.58133394", "0.5789787", "0.5779817", "0.5777069", "0.5752967", "0.5726033", "0.57251793", "0.5657184", "0.5645212", "0.5640987", "0.5640987", "0.5624115", "0.56046396", "0.5593...
0.74791336
0
fst.difference(StdVectorFst other) > difference of the two transducers
def difference(self, StdVectorFst other): # TODO merge symbol tables (union) if self.isyms and (self.isyms != other.isyms): raise ValueError('transducers must use shared input symbol table') if self.osyms and (self.osyms != other.osyms): raise ValueError('transducers must...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sub(first, other):\n if isinstance(first,FreeCAD.Vector) and isinstance(other,FreeCAD.Vector):\n return FreeCAD.Vector(first.x-other.x, first.y-other.y, first.z-other.z)", "def reverse_difference():", "def intersect(self, StdVectorFst other):\n if not (self.acceptor and other.acceptor):\n ...
[ "0.6086411", "0.6045616", "0.5977697", "0.59613603", "0.59549946", "0.5882719", "0.58611953", "0.57981336", "0.57964694", "0.57882184", "0.5762597", "0.5756364", "0.57557607", "0.5750434", "0.57060045", "0.5683181", "0.56800276", "0.5673425", "0.5637026", "0.5625878", "0.5625...
0.7712873
0
fst.closure() > Kleene closure of the transducer
def closure(self): cdef StdVectorFst result = self.copy() result.set_closure() return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _gen_closure(fnc,arg):\n return lambda s: fnc(arg)", "def propagate_state(s,t0,tf):\n\n return rk4(s,t0,tf)", "def closure(self, t):\n raise NotImplementedError", "def get_closure(self) -> \"CFG\":\n start_temp = Variable(\"#STARTCLOS#\")\n temp_1 = Terminal(\"#1CLOS#\"...
[ "0.5346936", "0.51668394", "0.5160571", "0.5095912", "0.506746", "0.50425196", "0.5014229", "0.49508715", "0.4922638", "0.4895189", "0.4888894", "0.487788", "0.48519778", "0.48373258", "0.47945848", "0.4771413", "0.47454786", "0.47433", "0.47428703", "0.47249597", "0.47178677...
0.5114269
3
fst.closure_plus() > Kleen plus closure (X+ = XX) of the transducer
def closure_plus(self): cdef StdVectorFst result = self.copy() result.set_closure(plus=True) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addition(self):\n\t\treturn lambda anything: self.__class__(\n\t\t\t(self[:], disj, checked_proposition(anything)[:])\n\t\t)", "def zzX_add_term(f, c, k=0):\n if poly_univariate_p(f):\n return zzx_add_term(f, c, k)\n\n if zzX_zero_p(c):\n return f\n\n n = len(f)\n m = n-k-1\n\n i...
[ "0.50570345", "0.5037606", "0.5026509", "0.49782056", "0.49160352", "0.49004078", "0.48918864", "0.48902607", "0.4848267", "0.4829272", "0.48242396", "0.47120345", "0.47120014", "0.47120014", "0.47050413", "0.46969607", "0.46718997", "0.46661776", "0.46263248", "0.4610262", "...
0.5831245
0
fst.inverse() > inverse of the transducer
def inverse(self): cdef StdVectorFst result = self.copy() result.invert() return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inverse(self):\n return self.invert()", "def __invert__(self):\n return self.inverse()", "def inverse(self):\n return self._inverse", "def inverse_transform(self, Xt):\n return self.transformer.inverse_transform(Xt)", "def inverse(self: T) -> T:", "def Inverse(self, freedo...
[ "0.67072284", "0.6670148", "0.663043", "0.65568477", "0.6543811", "0.64910984", "0.64910984", "0.6382784", "0.6382784", "0.6382784", "0.6382784", "0.6382784", "0.63146925", "0.6312613", "0.6309569", "0.62849003", "0.6252534", "0.6231935", "0.61974066", "0.6177345", "0.6133786...
0.6426065
7
fst.reverse() > reversed transducer
def reverse(self): cdef StdVectorFst result = StdVectorFst(isyms=self.isyms, osyms=self.osyms) openfst.Reverse(self.fst[0], result.fst) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reverse(seq):\n return seq[::-1]", "def reverse(seq):\n return seq[::-1]", "def reverse_this(seq):\n r_seq = seq[::-1]\n return r_seq", "def reverse_elements(seq):\n seq_copy = seq [::-1]\n return seq_copy", "def uninferable(seq):\n return reversed(seq)", "def rev(self):\n ...
[ "0.65589255", "0.65589255", "0.6322597", "0.62404", "0.61557543", "0.6151756", "0.6123157", "0.6069002", "0.6058933", "0.6027868", "0.60132813", "0.59784895", "0.5960527", "0.5904797", "0.59039223", "0.5903171", "0.58870864", "0.5848986", "0.582349", "0.5799277", "0.5793437",...
0.66294193
0
fst.shortest_distance(bool reverse=False) > length of the shortest path
def shortest_distance(self, bint reverse=False): cdef vector[openfst.TropicalWeight] distances openfst.ShortestDistance(self.fst[0], &distances, reverse) cdef unsigned i dist = [TropicalWeight(distances[i].Value()) for i in range(distances.size())] return dist
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shortestPathLength(self, graph):\n # binary representation of a state of which nodes visited.\n ans = (1 << len(graph)) - 1\n\n # typical template for bfs; initil\n qe = []\n visited = set()\n for i in range(len(graph)):\n qe.append((i, 1 << i))\n ...
[ "0.6468428", "0.6400149", "0.62307173", "0.6181717", "0.6119881", "0.61102235", "0.60731053", "0.6039813", "0.59823483", "0.5925195", "0.5919849", "0.5901156", "0.58949405", "0.58628094", "0.5846925", "0.58374566", "0.5829668", "0.5780163", "0.57778525", "0.5777451", "0.57663...
0.67651814
0
fst.shortest_path(int n=1) > transducer containing the n shortest paths
def shortest_path(self, unsigned n=1): if not isinstance(self, StdVectorFst): raise TypeError('Weight needs to have the path property and be right distributive') cdef StdVectorFst result = StdVectorFst(isyms=self.isyms, osyms=self.osyms) openfst.ShortestPath(self.fst[0], result.fst, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shortest_path(N, a_0, a_1=None):\n path = HJ_path(a_1*N, a_0*N)\n path = [c/d/N for c, d in path]\n return path", "def find_shortest_path(g, n, s, e):\n dist, prev = lazy_dijkstra(g, n, s)\n path = []\n if (dist[e] == inf):\n return path\n # loop backwards from the end vertex\n ...
[ "0.72574353", "0.6779499", "0.6626936", "0.65902966", "0.657986", "0.64826405", "0.6330357", "0.6329434", "0.6324753", "0.6273223", "0.62089425", "0.6148668", "0.61475307", "0.6145802", "0.61132425", "0.60910463", "0.60695976", "0.6064646", "0.6057583", "0.6035212", "0.603401...
0.723889
1
fst.push(final=False, weights=False, labels=False) > transducer with weights or/and labels pushed to initial (default) or final state
def push(self, final=False, weights=False, labels=False): cdef StdVectorFst result = StdVectorFst(isyms=self.isyms, osyms=self.osyms) cdef int ptype = 0 if weights: ptype |= openfst.kPushWeights if labels: ptype |= openfst.kPushLabels if final: openfst.StdArcPushFinal...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push_weights(self, final=False):\n return self.push(final, weights=True)", "def push(self, transition, *args, **kwargs):\n raise NotImplementedError", "def push_transition(self, s_tp1):\n self.states[self.pointer + 1] = s_tp1\n self.pointer += 1", "def push(self, state, action...
[ "0.6277243", "0.5895588", "0.5667142", "0.55976665", "0.559007", "0.5564427", "0.5254385", "0.5218644", "0.52134675", "0.5156183", "0.5109405", "0.5109405", "0.51072586", "0.5081782", "0.5081119", "0.5075794", "0.505604", "0.50500065", "0.5024904", "0.5011437", "0.50001043", ...
0.6876669
0
fst.push_weights(final=False) > transducer with weights pushed to initial (default) or final state
def push_weights(self, final=False): return self.push(final, weights=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push(self, final=False, weights=False, labels=False):\n cdef StdVectorFst result = StdVectorFst(isyms=self.isyms, osyms=self.osyms)\n cdef int ptype = 0\n if weights: ptype |= openfst.kPushWeights\n if labels: ptype |= openfst.kPushLabels\n if final:\n openfst.StdA...
[ "0.5956245", "0.56888956", "0.56398916", "0.56398916", "0.54933304", "0.54659986", "0.54577655", "0.5434372", "0.54123586", "0.54071677", "0.5347842", "0.5316553", "0.53136283", "0.530291", "0.5295784", "0.52882373", "0.52612233", "0.52612233", "0.52612233", "0.5259971", "0.5...
0.75353676
0
fst.push_labels(final=False) > transducer with labels pushed to initial (default) or final state
def push_labels(self, final=False): return self.push(final, labels=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push(self, final=False, weights=False, labels=False):\n cdef StdVectorFst result = StdVectorFst(isyms=self.isyms, osyms=self.osyms)\n cdef int ptype = 0\n if weights: ptype |= openfst.kPushWeights\n if labels: ptype |= openfst.kPushLabels\n if final:\n openfst.StdA...
[ "0.5967105", "0.5179531", "0.51263374", "0.5107814", "0.51046795", "0.506244", "0.5060464", "0.50451463", "0.5039498", "0.5032216", "0.5010942", "0.5009389", "0.5004121", "0.49748337", "0.49653673", "0.49534157", "0.49496177", "0.49412832", "0.49258912", "0.4917706", "0.49072...
0.7259111
0
fst.plus_map(value) > transducer with weights equal to the original weights plus the given value
def plus_map(self, value): cdef StdVectorFst result = StdVectorFst(isyms=self.isyms, osyms=self.osyms) if not isinstance(value, TropicalWeight): value = TropicalWeight(value) openfst.ArcMap(self.fst[0], result.fst, openfst.PlusStdArcMapper((<TropicalWeight> value).weight[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weight_expr(self, t, w_plus, z, value):\n pass", "def add_weight(self, from_neuron, to_neuron, value):\n index = (to_neuron * self.neuron_count) + from_neuron\n if index >= len(self.weights):\n raise IndexError(\"Out of range: from_neuron: {}, to_neuron: {}\".format(from_neuro...
[ "0.621839", "0.6114559", "0.600115", "0.5804063", "0.5722751", "0.5693648", "0.5687755", "0.5559211", "0.55528057", "0.5552691", "0.5549615", "0.5522629", "0.5510024", "0.5501206", "0.54631764", "0.54226154", "0.5411739", "0.53821194", "0.5376813", "0.53541845", "0.5352328", ...
0.71642935
0
fst.times_map(value) > transducer with weights equal to the original weights times the given value
def times_map(self, value): cdef StdVectorFst result = StdVectorFst(isyms=self.isyms, osyms=self.osyms) if not isinstance(value, TropicalWeight): value = TropicalWeight(value) openfst.ArcMap(self.fst[0], result.fst, openfst.TimesStdArcMapper((<TropicalWeight> value).weigh...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weighting(wb, m, a):\n s = control.tf([1, 0], [1])\n return (s/m + wb) / (s + wb*a)", "def comprehensive_transition_matrix(v, weight, n_bits):\n assert len(v) == n_parameters(weight, n_bits), \"v is the wrong dimension\"\n\n n_w = n_parameters_per_matrix(weight, n_bits)\n n_a = n_matrices_per_...
[ "0.58155817", "0.5608829", "0.54855907", "0.5482287", "0.54707223", "0.5318477", "0.5318477", "0.52631176", "0.52570164", "0.5213809", "0.5201124", "0.5189139", "0.51564693", "0.5148534", "0.5133489", "0.5125699", "0.51220584", "0.51186234", "0.51099324", "0.5065519", "0.5058...
0.68501806
0
fst.remove_weights() > transducer with weights removed
def remove_weights(self): cdef StdVectorFst result = StdVectorFst(isyms=self.isyms, osyms=self.osyms) openfst.ArcMap(self.fst[0], result.fst, openfst.RmTropicalWeightMapper()) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def RemoveWeights(frame, zero_nans=False):\n if \"Wpol\" not in frame and \"Wunpol\" not in frame:\n return\n\n if not frame[\"T\"].weighted:\n return frame\n ValidateMaps(frame)\n\n tmap = frame.pop(\"T\")\n\n if \"Wpol\" in frame:\n wmap = frame[\"Wpol\"]\n qmap = frame...
[ "0.62990224", "0.60294455", "0.59813094", "0.5881217", "0.57514244", "0.5749189", "0.5739195", "0.57177734", "0.56974894", "0.56974894", "0.5688978", "0.5655647", "0.5633824", "0.5622353", "0.55966955", "0.55897725", "0.555529", "0.55475813", "0.5521228", "0.5521228", "0.5496...
0.6814973
0
fst.invert_weights() > transducer with inverted weights
def invert_weights(self): cdef StdVectorFst result = StdVectorFst(isyms=self.isyms, osyms=self.osyms) openfst.ArcMap(self.fst[0], result.fst, openfst.InvertTropicalWeightMapper()) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalizeWeights(self):\n for wt in self.weights:\n wt[wt>1] = 1\n wt[wt<-1] = -1\n for bs in self.bias:\n bs[bs>1] = 1\n bs[bs<-1] = -1", "def __invert__(self):\n return self.fam.c_unop('invert', self)", "def invert(self):\n self.vert...
[ "0.6245089", "0.6137868", "0.5967409", "0.5943088", "0.5874188", "0.57992786", "0.579553", "0.57924", "0.5773543", "0.5705209", "0.566515", "0.56568927", "0.5629463", "0.5623858", "0.5580975", "0.55782956", "0.55737484", "0.55570453", "0.5556228", "0.55188745", "0.5512776", ...
0.7489498
0
fst.replace(label_fst_map, epsilon=False) > transducer with nonterminals replaced
def replace(self, label_fst_map, epsilon=False): assert self.osyms # used to encode labels cdef StdVectorFst result = StdVectorFst(isyms=self.isyms, osyms=self.osyms) cdef vector[pair[int, openfst.ConstStdVectorFstPtr]] label_fst_pairs cdef StdVectorFst fst label_fst_map['__ROOT_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addReplaceGraph(self, index_graph, index_namespace, *temp_namespaces):\n\n existing_indexes = list(set(index_graph.matchNamespace(index_namespace))) # target prefix?\n lp = len(index_namespace)\n suffixes = [int(u[lp:]) for u in existing_indexes]\n start = max(suffixes) + 1 if suf...
[ "0.55535024", "0.54823536", "0.54716563", "0.54646164", "0.53058475", "0.5207826", "0.5121671", "0.50306106", "0.5001328", "0.4949655", "0.49229786", "0.4922424", "0.49219033", "0.4906215", "0.489468", "0.487425", "0.48597205", "0.4857501", "0.48156703", "0.4814905", "0.48079...
0.7282194
0
fst.logprob_generate(n_path=1) > n_path random paths sampled according to weights assumed to encode log probabilities
def logprob_generate(self, n_path=1, max_len=None, weighted=False): cdef StdVectorFst result = StdVectorFst(isyms=self.isyms, osyms=self.osyms) cdef int seed = random.randint(0, INT_MAX) cdef openfst.LogProbStdArcSelector* selector = new openfst.LogProbStdArcSelector(seed) cdef int maxle...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_prob(self):", "def pathProb(self, path):\n # Establish initial state distribution.\n estState = []\n for s in range(self.P):\n estState.append(self.initial(path[0][0], s))\n logProb = 0\n for step in range(1, len(path)):\n # Calculate a softmax pro...
[ "0.6375611", "0.63293356", "0.6045664", "0.60323983", "0.6031593", "0.60283834", "0.59639466", "0.5921264", "0.59190476", "0.58894104", "0.58496875", "0.5776257", "0.5764778", "0.5742772", "0.5704037", "0.569994", "0.5676815", "0.5650656", "0.5642329", "0.5637369", "0.5636269...
0.744798
0
fst.uniform_generate(n_path=1) > n_path random paths sampled uniformly
def uniform_generate(self, n_path=1, max_len=None, weighted=False): cdef StdVectorFst result = StdVectorFst(isyms=self.isyms, osyms=self.osyms) cdef int seed = random.randint(0, INT_MAX) cdef openfst.UniformStdArcSelector* selector = new openfst.UniformStdArcSelector(seed) cdef int maxle...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample_paths(S0, N, u, d, q, M):\n value = S0*np.ones((M,1)) # M sample paths at once\n paths = np.zeros((M, N+1))\n paths[:,0] = value[:,0]\n for i in np.arange(1, N+1,1): # time steps\n random_values = bernoulli.rvs(size=(M,1),p=q)\n up_moves = random_values*u\n down_moves = ...
[ "0.6734564", "0.66847974", "0.6530481", "0.63904864", "0.6371103", "0.6327131", "0.61868405", "0.6162359", "0.6098373", "0.6078128", "0.60059524", "0.5981484", "0.5946395", "0.59069365", "0.58888686", "0.5843871", "0.5840873", "0.5838358", "0.58005655", "0.5798319", "0.579669...
0.653004
3
fst.paths() > iterator over all the paths in the transducer
def paths(self): return self._visit(self.start)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __iter__(self):\n for path in self._paths: yield autopaths.Path(path.complete_path)", "def current_paths(self) -> Iterator[List[Path]]:\n yield self._target_paths", "def __iter__(self):\n for (_,_,path) in self.frontierpq:\n yield path", "def paths(self, return_indices=Fal...
[ "0.68167454", "0.67005354", "0.6637809", "0.64093363", "0.6367687", "0.63561803", "0.63452667", "0.62497", "0.6217988", "0.62091696", "0.62034774", "0.59500223", "0.59325933", "0.59298396", "0.59014124", "0.5900734", "0.5889191", "0.5886623", "0.5873378", "0.5854071", "0.5852...
0.6516347
3
Method to remove samples with missing views PARAMETERS
def removeIncompleteSamples(data): print("Removing incomplete samples...") M = len(data) N = data[0].shape[0] samples_to_remove = [] for n in range(N): for m in range(M): if pd.isnull(data[m].iloc[n][0]): samples_to_remove.append(n) break if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_intent_classifier_del_training_samples_all(self):\n pass", "def test_intent_classifier_del_training_samples(self):\n pass", "def test_other_study_not_in_queryset(self):\n # Delete all but five source traits, so that there are 5 from each study.\n study2 = factories.StudyFac...
[ "0.5974973", "0.5966185", "0.58715934", "0.58715934", "0.5855055", "0.58248854", "0.5814161", "0.5801252", "0.57774687", "0.5772661", "0.57554215", "0.5704306", "0.56977016", "0.5693439", "0.5690832", "0.56738245", "0.5666975", "0.5666975", "0.5666975", "0.5644226", "0.563809...
0.6024295
0
Method to mask values of the data, It is mainly to test missing values and to evaluate imputation PARAMETERS
def maskData(data, data_opts): print("Masking data with the following options:") print("at random:") print(data_opts['maskAtRandom']) print("full cases:") print(data_opts['maskNSamples']) for m in range(len(data)): # Mask values at random D = data[m].shape[1] N = data[m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def applymask(self,mask):\n self.spec[mask==0]=np.nan", "def mask(self, data):\n masking_conditions = self.config.get('mask', None)\n if masking_conditions is not None:\n mask = np.isnan(data)\n masking_conditions = to_list(masking_conditions)\n for condition...
[ "0.71636206", "0.69299334", "0.6656439", "0.6598178", "0.65833426", "0.6500745", "0.6235333", "0.62148505", "0.6189413", "0.6060201", "0.6054242", "0.60385114", "0.6024093", "0.60088813", "0.5998645", "0.59780157", "0.596528", "0.5955262", "0.5953874", "0.5943176", "0.5916484...
0.65955365
4
Method to load the data PARAMETERS
def loadData(data_opts, verbose=True): print ("\n") print ("#"*18) print ("## Loading data ##") print ("#"*18) print ("\n") sleep(1) M = len(data_opts['input_files']) Y = [None]*M for m in range(M): # Read file file = data_opts['input_files'][m] Y[m] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_parameter(self):", "def load_data(self):", "def load_data(self) -> None:", "def load_parameters(self):\n json_data = open(\"param.json\")\n data = json.load(json_data)\n self.items = data[\"items\"]\n self.pollInterval = self.items[0]['poll_interval']", "def load_param...
[ "0.7619791", "0.7215906", "0.7184702", "0.7089878", "0.70850396", "0.6927192", "0.68864596", "0.67514884", "0.67035496", "0.6678682", "0.66307455", "0.6583257", "0.65438026", "0.65285", "0.65189654", "0.65092236", "0.64984846", "0.6477738", "0.64763254", "0.6449944", "0.64173...
0.0
-1
Method to create an array filled with missing values
def nans(shape, dtype=float): a = np.empty(shape, dtype) a.fill(np.nan) return a
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_missing():\n return RaggedArray([[], [-1, 0, 1]], dtype='int16')", "def data_missing_for_sorting():\n return RaggedArray([[1, 0], [], [0, 0]])", "def get_fixed_array():\n return np.array([[[np.nan, np.nan],\n [np.nan, np.nan],\n [np.nan, np.nan]],\n\n...
[ "0.75115675", "0.68511885", "0.683553", "0.66644394", "0.6584856", "0.65045017", "0.6430179", "0.63518476", "0.6322441", "0.6280949", "0.62538046", "0.6221733", "0.6131918", "0.611479", "0.6114637", "0.6104368", "0.6098019", "0.6086872", "0.60868573", "0.6044928", "0.6027729"...
0.62669516
10
Method to efficiently compute correlation coefficients between two matrices PARMETERS
def corr(A,B): # Rowwise mean of input arrays & subtract from input arrays themeselves A_mA = A - A.mean(1)[:,None] B_mB = B - B.mean(1)[:,None] # Sum of squares across rows ssA = (A_mA**2).sum(1); ssB = (B_mB**2).sum(1); # Finally get corr coeff return np.dot(A_mA,B_mB.T)/np.sqrt(np....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def coupling_coef_corrs(fits_path, dataset1, dataset2):\n fits = h5py.File(fits_path, 'r')\n coefs1 = np.median(fits[dataset1]['coupling_coefs'][:], axis=0)\n coefs2 = np.median(fits[dataset2]['coupling_coefs'][:], axis=0)\n\n n_neurons = coefs1.shape[0]\n corrs = np.zeros(n_neurons)\n\n for neur...
[ "0.69910353", "0.68758065", "0.672521", "0.67033434", "0.6432826", "0.64027905", "0.63520557", "0.63299096", "0.6239334", "0.616585", "0.61632824", "0.61550903", "0.6148199", "0.61245817", "0.59955454", "0.599502", "0.5986781", "0.5969329", "0.595005", "0.59464985", "0.591657...
0.65618134
4
Multiply a full matrix by a diagonal matrix. This function should always be faster than dot.
def ddot(d, mtx, left=True): if left: return (d*mtx.T).T else: return d*mtx
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def r_diag_dot_sparse(mat, diag):\n return mat @ sp.diags(diag)", "def mult_diag(d, mtx, left=True):\n if left:\n return (d*mtx.T).T\n else:\n return d*mtx", "def mult_diag(d, mtx, left=True):\n if left:\n return (d*mtx.T).T\n else:\n return d*mtx", "def l_diag_dot_...
[ "0.7025872", "0.6932095", "0.6932095", "0.67525864", "0.6566778", "0.641041", "0.6377108", "0.6349031", "0.6344702", "0.6274619", "0.62428904", "0.61872375", "0.61565834", "0.61009675", "0.60421216", "0.60006547", "0.6000634", "0.5992185", "0.59488285", "0.59419817", "0.59356...
0.5908293
26
Method to save the parameters of the model in an hdf5 file PARAMETERS
def saveParameters(model, hdf5, view_names=None): # Get nodes from the model nodes = model.getNodes() # Create groups param_grp = hdf5.create_group("parameters") # Iterate over nodes for node in nodes: # Collect node parameters parameters = nodes[node].getParameters() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_h5(self, filename):\n try:\n shutil.copyfile(filename, '{0}_bak'.format(filename))\n except IOError:\n print 'could not make backup of trainer param file (which is \\\n normal if we haven\\'t saved one until now)'\n paramfile = tables.openFile(...
[ "0.7547686", "0.73266137", "0.7147719", "0.7146818", "0.6927567", "0.6904685", "0.68432915", "0.68017304", "0.67344093", "0.6733551", "0.672723", "0.66911286", "0.6661018", "0.6638081", "0.66352516", "0.66027856", "0.6602723", "0.6579461", "0.6574098", "0.65592694", "0.655190...
0.70732796
4
Method to save the expectations of the model in an hdf5 file PARAMETERS
def saveExpectations(model, hdf5, view_names=None): # Get nodes from the model nodes = model.getNodes() exp_grp = hdf5.create_group("expectations") # Iterate over nodes for node in nodes: # Collect node expectations expectations = nodes[node].getExpectations() # Multi-vi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_as_hdf5(self, filename):", "def save_to_hd5(out_file, x_train, y_train, x_val, y_val, x_test, y_test):\n data = h5py.File(out_file, \"w\")\n train_data = data.create_group(\"train_data\")\n train_data.create_dataset(\"x_train\", data=x_train)\n train_data.create_dataset(\"y_train\", data=y_t...
[ "0.7144187", "0.70023483", "0.69948673", "0.68017226", "0.67596805", "0.6758356", "0.6758035", "0.6658788", "0.6644143", "0.66394436", "0.661126", "0.66050243", "0.6585072", "0.64933044", "0.6485472", "0.6483811", "0.64647233", "0.6452282", "0.64113677", "0.6400059", "0.63887...
0.6884746
3
Method to save the training statistics in an hdf5 file PARAMETERS
def saveTrainingStats(model, hdf5): stats = model.getTrainingStats() stats_grp = hdf5.create_group("training_stats") stats_grp.create_dataset("activeK", data=stats["activeK"]) stats_grp.create_dataset("elbo", data=stats["elbo"]) stats_grp.create_dataset("elbo_terms", data=stats["elbo_terms"].T) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_as_hdf5(self, filename):", "def save_h5(self, filename):\n try:\n shutil.copyfile(filename, '{0}_bak'.format(filename))\n except IOError:\n print 'could not make backup of trainer param file (which is \\\n normal if we haven\\'t saved one until now)...
[ "0.76186526", "0.74484", "0.7302508", "0.7036124", "0.68702656", "0.68636805", "0.6862404", "0.6836825", "0.6830172", "0.6630677", "0.6627013", "0.66142386", "0.65550214", "0.64987785", "0.64877", "0.64374703", "0.6429999", "0.64238906", "0.64071083", "0.64017457", "0.6395792...
0.79240113
0
Method to save the training options in an hdf5 file PARAMETERS
def saveTrainingOpts(opts, hdf5): # Remove dictionaries from the options for k,v in opts.copy().items(): if type(v)==dict: for k1,v1 in v.items(): opts[str(k)+"_"+str(k1)] = v1 opts.pop(k) # Create HDF5 data set hdf5.create_dataset("training_opts", data=n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_h5(self, filename):\n try:\n shutil.copyfile(filename, '{0}_bak'.format(filename))\n except IOError:\n print 'could not make backup of trainer param file (which is \\\n normal if we haven\\'t saved one until now)'\n paramfile = tables.openFile(...
[ "0.7541448", "0.71382374", "0.6994086", "0.6971694", "0.6970202", "0.692363", "0.6838004", "0.68295485", "0.66984445", "0.6564147", "0.64481384", "0.64433485", "0.63179415", "0.6317367", "0.6292988", "0.6272117", "0.6240768", "0.62215", "0.6210662", "0.61986285", "0.6158499",...
0.757535
0
Method to save the model options in an hdf5 file PARAMETERS
def saveModelOpts(opts, hdf5): opts_interest = ["learnIntercept","schedule","likelihood","sparsity"] opts = dict((k, opts[k]) for k in opts_interest) grp = hdf5.create_group('model_opts') for k,v in opts.items(): grp.create_dataset(k, data=np.asarray(v).astype('S')) grp[k].attrs['names'] = n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_h5(self, filename):\n try:\n shutil.copyfile(filename, '{0}_bak'.format(filename))\n except IOError:\n print 'could not make backup of trainer param file (which is \\\n normal if we haven\\'t saved one until now)'\n paramfile = tables.openFile(...
[ "0.71215373", "0.69332534", "0.6906875", "0.68623835", "0.6848984", "0.6801983", "0.6710405", "0.6583333", "0.65404475", "0.6526262", "0.6478722", "0.64776677", "0.64507914", "0.64346147", "0.6415686", "0.6334888", "0.6334126", "0.63304484", "0.6325904", "0.6320708", "0.63110...
0.76416385
0
Method to save the training data in an hdf5 file PARAMETERS
def saveTrainingData(model, hdf5, view_names=None, sample_names=None, feature_names=None, likelihoods=None): data = model.getTrainingData() data_grp = hdf5.create_group("data") featuredata_grp = hdf5.create_group("features") hdf5.create_dataset("samples", data=np.array(sample_names, dtype='S50')) i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_to_hd5(out_file, x_train, y_train, x_val, y_val, x_test, y_test):\n data = h5py.File(out_file, \"w\")\n train_data = data.create_group(\"train_data\")\n train_data.create_dataset(\"x_train\", data=x_train)\n train_data.create_dataset(\"y_train\", data=y_train)\n if x_val is not None:\n ...
[ "0.7822894", "0.7725884", "0.7424584", "0.7117243", "0.70354587", "0.6928284", "0.6915982", "0.690596", "0.6839403", "0.6725721", "0.66865355", "0.66797966", "0.667506", "0.6665772", "0.666074", "0.6606604", "0.65744895", "0.65569764", "0.6539012", "0.6525144", "0.64931834", ...
0.722142
3
Method to save the model in an hdf5 file PARAMETERS TOFILL....
def saveModel(model, outfile, train_opts, model_opts, view_names=None, sample_names=None, feature_names=None): # QC checks assert model.trained == True, "Model is not trained yet" assert len(np.unique(view_names)) == len(view_names), 'View names must be unique' assert len(np.unique(sample_names)) == le...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_as_hdf5(self, filename):", "def save_model(model):\n\n # model.save(os.path.join(output))\n # model.save(output)\n\n # key = \"{}/{}/examples\".format(prefix,data_partition_name)\n # url = 's3://{}/{}'.format(bucket, key)\n # boto3.Session().resource('s3').Bucket(bucket).Object(key).uploa...
[ "0.73960996", "0.731551", "0.7309908", "0.72724366", "0.7142838", "0.7141108", "0.7065175", "0.7059794", "0.70176214", "0.691764", "0.6897659", "0.68805915", "0.6796363", "0.6791728", "0.67818874", "0.67726684", "0.6762847", "0.6758171", "0.67317086", "0.6717588", "0.6701124"...
0.6544464
31
Log in method using Flask Session or JWT Tokens
def log_in(jwt): return current_app.library_registry.admin_controller.log_in(jwt)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def login():\n\n\n params = request.get_json()\n username = params.get('username', None)\n password = params.get('password', None)\n\n if not username:\n return jsonify({\"msg\": \"Missing username parameter\"}), Status.HTTP_BAD_REQUEST\n if not password:\n return jsonify({\"msg\": \"M...
[ "0.7737604", "0.7585224", "0.7482271", "0.7449282", "0.726527", "0.72297525", "0.72285867", "0.722037", "0.7208943", "0.71985704", "0.7189562", "0.718633", "0.71839875", "0.71826035", "0.71805346", "0.71698403", "0.71253777", "0.71253777", "0.71122885", "0.71045136", "0.70843...
0.74313056
4
Refresh JWT access token method
def refresh_token(): return current_app.library_registry.admin_controller.refresh_token()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def refresh():\n print(\"refresh request\")\n old_token = request.get_data()\n new_token = guard.refresh_jwt_token(old_token)\n ret = {'access_token': new_token}\n return ret, 200", "def refresh():\n current_user = get_jwt_identity()\n ret = {\n 'access_token': create_access_token(ide...
[ "0.8614901", "0.84700114", "0.837138", "0.81414944", "0.8075031", "0.7895597", "0.78880507", "0.7861867", "0.7860082", "0.7757345", "0.77382714", "0.76169086", "0.75803554", "0.7454972", "0.7405347", "0.7377548", "0.7362062", "0.73072666", "0.72705334", "0.7247686", "0.717756...
0.6679031
47
! Searches output string
def get_testcase_summary(output): print("Inside Test Summary") re_tc_summary = re.compile(r"^\[(\d+\.\d+)\][^\]+\{\{(__testcase_summary);(\d+);(\d+)\}\}") #re_tc_summary = re.compile(r"^\[(\d+\.\d+)\][^\{]+\{\{(__testcase_summary);(\d+);(\d+)\}\}") print("re_tc_summary =",re_tc_summary.pattern) #pri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output_found(text, data=None):\n if conf.eval_output:\n info_dict = {'type':'found', 'text' : text}\n info_dict.update(data or {})\n output_result_eval(info_dict)\n else:\n output_result('[FOUND] ' + text)", "def search(self, word):", "def check_output_contains(context, te...
[ "0.65649", "0.65356344", "0.646662", "0.64281803", "0.62923485", "0.614656", "0.60025", "0.5984303", "0.59813017", "0.59785056", "0.59713686", "0.5938507", "0.5930746", "0.5929708", "0.5922938", "0.5891811", "0.58884245", "0.5881193", "0.5878786", "0.58357304", "0.58278275", ...
0.0
-1
Initialize exceptions for the Subaru Starlink API.
def __init__(self, message, *args, **kwargs): self.message = message super().__init__(*args, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, error_msg):\n super(ConnectionException, self).__init__(error_msg)", "def __init__(self, error_msg):\n super(SdkException, self).__init__()\n self.error_msg = error_msg", "def __init__(self, exception, message=\"Invalid requests parse!\"):\n self.message = message...
[ "0.6374355", "0.62550896", "0.62483984", "0.5911717", "0.5911717", "0.5911717", "0.58959407", "0.5885883", "0.5797883", "0.5780054", "0.5775571", "0.57683134", "0.5766834", "0.5758749", "0.575373", "0.57343733", "0.57154894", "0.5673905", "0.5631225", "0.5631225", "0.5619317"...
0.0
-1
Execute only if run as a script.
def main(): if '-h' in sys.argv or '--help' in sys.argv: print_help() arguments = map_arguments() sys.stdout.write('Converting from standard input (use -h for help) ...\n') pool = Pool() src_files = pool.map(convert_files, enumerate(sys.stdin.readlines())) pool.close() pool.join()...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self, _):\n ida_kernwin.warning(\"IDACpp cannot be run as a script\")\n return False", "def run_script(self):\n pass", "def execute(self, args=\"\"):\r\n return super(PythonScript, self).execute(_EXECUTABLE, args)", "def run_if_interactive(self):\n pass", "def scr...
[ "0.6625024", "0.66240704", "0.64144194", "0.6329798", "0.6242908", "0.6166826", "0.6162134", "0.61572427", "0.6137846", "0.60983455", "0.5957475", "0.59561884", "0.5948326", "0.5938682", "0.59291065", "0.59132427", "0.59085315", "0.589553", "0.58948565", "0.58764416", "0.5855...
0.0
-1
Maps the sys.argv to a dictionary and returns it. Omits sys.argv[0]. You may also look at OptionParser.
def map_arguments(): arguments = { '-c': 'ogg', '-d': 'no', '-q': '4' } args = sys.argv[:] args.pop(0) while len(args) > 1: if args[0] == '-c' and re.search('^mp3$|^ogg$', args[1]) or \ args[0] == '-d' and re.search('^y(es)?$', args[1]) or \ ar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def retrieve_args_dict():\n process_args = sys.argv[1:]\n dictionary = dict()\n for process_arg in process_args:\n splitted = process_arg.split(\":\")\n if len(splitted) > 1:\n key = splitted[0]\n value = \"\".join(splitted[1:])\n dictionary[key] = value\n ...
[ "0.7385237", "0.7118634", "0.6816529", "0.67994505", "0.65655065", "0.6522211", "0.6495122", "0.6454298", "0.6454298", "0.6422819", "0.6410535", "0.63859236", "0.6361472", "0.63351923", "0.63333267", "0.6328651", "0.62523013", "0.62460315", "0.62011284", "0.6116458", "0.61064...
0.64495105
9
Returns the right file extension, codec and audio quality based on the command line arguments.
def audio_codec(): arguments = map_arguments() if arguments['-c'] == 'ogg': return '.ogg', 'libvorbis', arguments['-q'] elif arguments['-c'] == 'mp3': return '.mp3', 'libmp3lame', arguments['-q']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n songs = []\n first_line = sys.stdin.readline().split(' ', 1)\n songs_on_album, songs_to_select = int(first_line[0]), int(first_line[1])\n for i in range(songs_on_album):\n line = sys.stdin.readline().split(' ', 1)\n song = Song(line[1], int(line[0]), i+1)\n songs.append(song)\n\n print_...
[ "0.56709796", "0.5644258", "0.55935603", "0.55931133", "0.5572692", "0.54806256", "0.5473442", "0.54529715", "0.5429261", "0.5399557", "0.53953904", "0.53751093", "0.5370239", "0.53674275", "0.5362373", "0.5354838", "0.5344439", "0.5343309", "0.5330692", "0.5306567", "0.52950...
0.7217277
0
Uses multiprocessin to convert multiple files at once. Returns the converted source file (used in delete_files function).
def convert_files(enumerated_src_file): i, src_file = enumerated_src_file src_file = src_file.strip() file_extension, acodec, quality = audio_codec() dst_file = '.'.join(src_file.split('.')[:-1]) + file_extension sys.stdout.write(str(i + 1) + ': ' + src_file + ' -> ' + dst_file + '\n') subproce...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_files_parallel(self) -> None:\n file_paths = []\n for file in os.listdir(self.audios_dir):\n if file.endswith(self.input_format):\n file_paths.append(os.path.join(\n self.audios_dir, file))\n with Pool(cpu_count()) as p:\n p.m...
[ "0.7930838", "0.67868215", "0.6713706", "0.66260254", "0.6605663", "0.6512112", "0.64368165", "0.63372135", "0.6322044", "0.6287195", "0.62597674", "0.6028215", "0.60169154", "0.60037804", "0.5979012", "0.5960334", "0.5936236", "0.5925249", "0.59102845", "0.58939767", "0.5880...
0.608454
11
Deletes the source files when d yes is used as an argument to the console.
def delete_files(src_files): for i, src_file in enumerate(src_files): sys.stdout.write(str(i + 1) + ': ' + src_file + '\n') subprocess.call(['rm', src_file])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scrub():\n\n\tlocal(\"rm -fr dist build\")\n\tlocal(\"find . -name \\\"*.pyc\\\" -exec rm '{}' ';'\")", "def clean():\n for dirpath, dirnames, filenames in os.walk('.'):\n for filename in filenames:\n if filename.endswith('.pyc') or filename.endswith('.pyo'):\n full_pathna...
[ "0.64925873", "0.6472665", "0.64230376", "0.6391575", "0.637083", "0.63624465", "0.6295995", "0.6258228", "0.62149173", "0.6147259", "0.6144624", "0.6119391", "0.60543656", "0.60124403", "0.59782493", "0.59513044", "0.59416646", "0.59151274", "0.5907112", "0.58845353", "0.588...
0.635088
6
Prints help when the h or help argument is used in the command line.
def print_help(): sys.stdout.write( 'Use: find [ARGUMENTS] ... | mediatoaudio.py [ARGUMENTS] ...\n' ' or: ls [ARGUMENTS] ... | mediatoaudio.py [ARGUMENTS] ...\n' 'mediatoaudio.py uses standard input to convert files with ffmpeg.\n' '\nArguments:\n' \ ' -c\taudio codec\t\togg...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_cli_help(self):\n output = self.update_command('-h')", "def printhelp():", "def _help(self):\n self.onecmd('help')", "def show_help():\n pass", "def print_help():\n\tprint(\"Help text\")", "def help():\n print(UI.HELP)", "def ShortHelp(doexit=True):\n print(parser.de...
[ "0.80226815", "0.7880057", "0.7862627", "0.78081363", "0.7797057", "0.7785448", "0.77128595", "0.7686523", "0.76731783", "0.76218337", "0.75972503", "0.7589725", "0.75646996", "0.7560763", "0.7560303", "0.7546299", "0.74988663", "0.7487726", "0.7486519", "0.74784267", "0.7468...
0.68655795
88
Here explain the definition of the gromacs weight
def AleWeights(temperatures, internal_energies, target_temperatures, integrator = 'trapezoid', alpha = None, weight_GROMACS_format = True): # Selecting the integrator method if integrator == 'trapezoid': integrator = integrate.trapz elif integrator == 'trapz': integrator = np.trapz elif...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weight(self):", "def getWeight(self) -> float:\n ...", "def get_weights(self):", "def get_weight(self):\n pass", "def get_weight(self):\n pass", "def gated_weighting(g, w_content, w_previous):\n\n return g * w_content + (1-g) * w_previous", "def weights(self):\r\n\t\tret...
[ "0.72532266", "0.69395727", "0.6821024", "0.6741765", "0.6741765", "0.66126347", "0.6605744", "0.65307605", "0.6522943", "0.64295447", "0.6369714", "0.6369714", "0.6369714", "0.6369714", "0.6369714", "0.6369714", "0.6369714", "0.6369714", "0.63524663", "0.6337981", "0.6276387...
0.0
-1
The two input is a list that could be obtained from mdp.annealing3 The structure is the following annealing_times = [t1, t2, t3, t4, t5, t6]
def get_energy(edr, annealing_times, energy_type = 'Potential', out_fig = 'energy_distribution.svg'): # Could be Total-Energy fig, ax = plt.subplots(figsize = (16,9)) data = pd.DataFrame() xvg_tmp_file = tempfile.NamedTemporaryFile(suffix='.xvg') energy = [] iterator = range(0, len(annealing_times)-...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spin_adapted_t2(creation_list, annihilation_list):\n _check_int_list(creation_list, \"creation operators\")\n _check_int_list(annihilation_list, \"annihilation operators\")\n\n if len(creation_list) != 2 or len(annihilation_list) != 2:\n raise ValueError(f\"T2 excitations take exactly 2 indices...
[ "0.59733194", "0.583341", "0.5753424", "0.57403886", "0.56659484", "0.56205523", "0.5589108", "0.55861825", "0.5484096", "0.5454451", "0.54484034", "0.54357857", "0.5422951", "0.5390583", "0.53496975", "0.53313315", "0.52978075", "0.5269319", "0.52431566", "0.5222972", "0.515...
0.0
-1
This function read a log file obtained from simulated tempering and returns a numpy array of shape (number of time points, number of states, 2) The first axis of the array refears to each output on the log file. The second axis refears to the temperature states And the last one to the counts and value of the correspond...
def get_weights_from_log(log, plot = False): with open(log, 'r') as f: log_file = f.readlines() i = 0 time = [] weights_info = [] weights_0 = [] while i < len(log_file): if 'init-lambda-weights[' in log_file[i]: weights_0.append(float(log_file[i].split('=')[-1])) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getWeights(self, format='list'):\n timer = None\n if conf.config.getboolean(\"Reports\", \"outputTimesForSections\"):\n timer = Timer()\n timer.start_timing()\n synapse_list = self._get_synaptic_data()\n if conf.config.getboolean(\"Reports\", \"outputTimesForSe...
[ "0.5679781", "0.5495576", "0.5362034", "0.527573", "0.5247644", "0.51613903", "0.51452", "0.51238173", "0.5120641", "0.5115963", "0.50911295", "0.50866115", "0.49406517", "0.4936814", "0.4911786", "0.48889357", "0.486517", "0.48642686", "0.4859323", "0.48575228", "0.4830234",...
0.7046495
0
Load a COBRApy Model object into the GEMPRO project.
def load_cobra_model(self, model): self.model = ModelPro(model) for g in self.model.genes: if self.genes_dir: g.root_dir = self.genes_dir g.protein.pdb_file_type = self.pdb_file_type self.genes = self.model.genes log.info('{}: loaded model'.format...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_model(self) -> Any:", "def load(path_to_model):\n pass", "def load_model(self):\n pass", "def load_model(self, model_path: str):", "def _load_model(self):\n with open(self.filepath, 'rb') as file:\n self.cmodel = pickle.load(file)", "def load_model(self, path):\n ...
[ "0.75577265", "0.74616426", "0.7443691", "0.72105366", "0.71995646", "0.71612245", "0.70299786", "0.697022", "0.6902634", "0.68662226", "0.66627985", "0.66133004", "0.6587798", "0.65446216", "0.6522303", "0.6507763", "0.64993095", "0.64980847", "0.6494972", "0.6485254", "0.64...
0.6683296
10