query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Caches the available locales list as both strings and symbols in a Set, so that we can have faster lookups to do the available locales enforce check. source://i18n//lib/i18n/config.rb50 | def available_locales_set; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def used_locales\r\n locales = globalize.stash.keys.concat(globalize.stash.keys).concat(translations.translated_locales)\r\n locales.uniq!\r\n locales\r\n end",
"def available_locales\n locales = self.keys.map { |k| k =~ /\\./; $` }\n locales.uniq!\n locales.compact!\n local... | [
"0.7525165",
"0.72818416",
"0.72818416",
"0.72321254",
"0.72142446",
"0.71887887",
"0.71097803",
"0.71097803",
"0.7088116",
"0.70164996",
"0.6978896",
"0.69147426",
"0.6868781",
"0.68599707",
"0.6820874",
"0.6819864",
"0.67624193",
"0.6753491",
"0.6753491",
"0.67385703",
"0.6... | 0.7505384 | 1 |
Returns the current backend. Defaults to +Backend::Simple+. source://i18n//lib/i18n/config.rb20 | def backend; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def backend\n @backend ||= Configurator.new(self, :backend)\n end",
"def backend\n @backend ||= self.class.backend\n end",
"def backend_name\n config['backend']\n end",
"def active_backend\n SSHKit::Custom::Config::Store.active_backend\n end",
"def default_backend\n ... | [
"0.80344975",
"0.7752104",
"0.77507573",
"0.7545812",
"0.73210055",
"0.69849074",
"0.68068075",
"0.6760333",
"0.6757637",
"0.6757637",
"0.664916",
"0.6618469",
"0.6605976",
"0.6582485",
"0.65360755",
"0.6420126",
"0.6333426",
"0.6315479",
"0.6283491",
"0.62307334",
"0.6220847... | 0.62047493 | 22 |
Sets the current backend. Used to set a custom backend. source://i18n//lib/i18n/config.rb25 | def backend=(backend); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_backend(val)\n end",
"def set_backend\n @backend = Backend.find(params[:id])\n end",
"def backend=(backend)\n @backend = backend&.to_sym\n set_encoder\n end",
"def backend\n @backend ||= Configurator.new(self, :backend)\n end",
"def backend=(backend)\n RSpec.confi... | [
"0.7529817",
"0.73311514",
"0.7327457",
"0.71799064",
"0.68861926",
"0.658184",
"0.6571819",
"0.65657586",
"0.62031704",
"0.610168",
"0.6049615",
"0.604867",
"0.6046211",
"0.60309273",
"0.60204005",
"0.60204005",
"0.5998594",
"0.5903728",
"0.58489794",
"0.5844033",
"0.5838511... | 0.72503394 | 3 |
Clears the available locales set so it can be recomputed again after I18n gets reloaded. source://i18n//lib/i18n/config.rb70 | def clear_available_locales_set; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_stats!\r\n @@available_locales = nil\r\n @@enabled_locales = nil\r\n @@language_completion = nil\r\n @@all_translation_info = nil\r\n @@datetime_vars = nil\r\n end",
"def used_locales\r\n locales = globalize.stash.keys.concat(globalize.stash.keys).concat(tra... | [
"0.6305831",
"0.63036907",
"0.621971",
"0.61627036",
"0.5980066",
"0.5942033",
"0.5900893",
"0.5896212",
"0.58955187",
"0.5887825",
"0.5867933",
"0.5847686",
"0.5841113",
"0.5746414",
"0.5731636",
"0.5727976",
"0.5725601",
"0.5716796",
"0.5686499",
"0.56807715",
"0.5673065",
... | 0.8240911 | 0 |
Returns the current default locale. Defaults to :'en' source://i18n//lib/i18n/config.rb30 | def default_locale; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_locale\n evaluate_localization_option!(:default_locale)\n end",
"def default_locale\n @default_locale ||= self.languages.get_default.code.to_sym\n end",
"def default_locale\n return nil unless localized?\n u_lc = I18n.locale.to_sym\n available_locales.include?(u_lc)... | [
"0.8744718",
"0.85260564",
"0.851315",
"0.8174861",
"0.8157387",
"0.8117677",
"0.81124645",
"0.8079371",
"0.7882876",
"0.78363305",
"0.78314203",
"0.75377023",
"0.74629706",
"0.74251395",
"0.7372892",
"0.7318558",
"0.7318558",
"0.7317624",
"0.7209973",
"0.71269745",
"0.704787... | 0.7483424 | 12 |
Sets the current default locale. Used to set a custom default locale. source://i18n//lib/i18n/config.rb35 | def default_locale=(locale); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_default_locale\n locale = config.dig(\"locale\").split(\"- \").last\n\n application nil do\n <<~CONFS\n # Default i18n locale\n config.i18n.default_locale = :#{locale}\n\n CONFS\n end\n\n template \"templates/default_locale.tt\", \"confi... | [
"0.8020997",
"0.7959246",
"0.7887661",
"0.7816902",
"0.74436617",
"0.7337984",
"0.7262668",
"0.7251115",
"0.72001535",
"0.71888775",
"0.71722114",
"0.71719927",
"0.7158044",
"0.71401674",
"0.71401674",
"0.71345735",
"0.7017585",
"0.70039713",
"0.69755846",
"0.6938289",
"0.690... | 0.75714976 | 4 |
Returns the current default scope separator. Defaults to '.' source://i18n//lib/i18n/config.rb75 | def default_separator; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def period_separator\n '.'\n end",
"def default_line_separator\n @def_line_sep ||= infer_line_separator\n end",
"def default_separator=(separator); end",
"def default_separator(value = T.unsafe(nil)); end",
"def trailing_dots_to_scope_name!\n @hsh = self.class.tdtsn @hsh, scope_name\n end",... | [
"0.6190831",
"0.61389744",
"0.606381",
"0.58894265",
"0.5763356",
"0.567675",
"0.55871004",
"0.55486345",
"0.55370724",
"0.5493453",
"0.5467525",
"0.5446332",
"0.5423758",
"0.53667825",
"0.53614277",
"0.5360762",
"0.5360762",
"0.53599805",
"0.5357077",
"0.53401446",
"0.531959... | 0.63961184 | 0 |
Sets the current default scope separator. source://i18n//lib/i18n/config.rb80 | def default_separator=(separator); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_line_separator\n @def_line_sep ||= infer_line_separator\n end",
"def default_separator; end",
"def default_separator(value = T.unsafe(nil)); end",
"def separator=(value)\n @separator = value\n end",
"def path_sep=(val)\n Vitals::Utils.path_sep = val\n end",... | [
"0.6848044",
"0.67540807",
"0.62274724",
"0.609345",
"0.5825628",
"0.53762394",
"0.5374709",
"0.5310626",
"0.52978414",
"0.52885926",
"0.52831006",
"0.52605486",
"0.5254276",
"0.5254276",
"0.5233846",
"0.5233846",
"0.5230837",
"0.52280027",
"0.51832384",
"0.51468235",
"0.5114... | 0.7294296 | 0 |
Returns the current exception handler. Defaults to an instance of I18n::ExceptionHandler. source://i18n//lib/i18n/config.rb86 | def exception_handler; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exception_handler\n @exception_handler ||= {}\n end",
"def get_exception_handler(e)\n table = self.class.exception_handler\n e.class.ancestors.each do |mod|\n return table[mod] if table.has_key?(mod)\n end\n end",
"def config\n Wrangler::ExceptionHandler.co... | [
"0.6627483",
"0.6569164",
"0.6310145",
"0.6192599",
"0.6063831",
"0.59797996",
"0.59267753",
"0.56218183",
"0.54783636",
"0.535776",
"0.5351201",
"0.53141886",
"0.51999336",
"0.5161768",
"0.5095055",
"0.5076625",
"0.5074937",
"0.5032617",
"0.49993965",
"0.49705985",
"0.495459... | 0.49354693 | 22 |
Sets the exception handler. source://i18n//lib/i18n/config.rb91 | def exception_handler=(exception_handler); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def i18n\n return unless defined?(I18n)\n I18n.config.exception_handler = ->(exception, _locale, _key, _options) do\n raise exception.respond_to?(:to_exception) ? exception.to_exception : exception\n end\n end",
"def exception_handler\n @exception_handler ||= {}\n end",
"de... | [
"0.7286301",
"0.6443783",
"0.6399727",
"0.62148654",
"0.6202593",
"0.61766106",
"0.59608763",
"0.5849426",
"0.5799362",
"0.57777995",
"0.5645895",
"0.5636454",
"0.56064546",
"0.5556423",
"0.55394614",
"0.5509799",
"0.55031306",
"0.5468964",
"0.5463749",
"0.5441261",
"0.543817... | 0.6949438 | 1 |
Returns the current interpolation patterns. Defaults to I18n::DEFAULT_INTERPOLATION_PATTERNS. source://i18n//lib/i18n/config.rb151 | def interpolation_patterns; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def region_patterns\n @@region_patterns\n end",
"def interpolators()\n return @interpolators\n end",
"def term_qa_replacement_patterns\n Config.config_value(term_config, :qa_replacement_patterns)\n end",
"def patterns_for_file( file )\n Hash(config_file(file)[:patterns]).keys +... | [
"0.58912766",
"0.5884981",
"0.58711416",
"0.5808277",
"0.5632519",
"0.5521293",
"0.5463352",
"0.5445024",
"0.54146683",
"0.53358305",
"0.5327459",
"0.5255294",
"0.51123923",
"0.5088376",
"0.50714624",
"0.50555164",
"0.5011109",
"0.49977556",
"0.4968294",
"0.4949765",
"0.49326... | 0.7268299 | 0 |
Allow clients to register paths providing translation data sources. The backend defines acceptable sources. E.g. the provided SimpleBackend accepts a list of paths to translation files which are either named .rb and contain plain Ruby Hashes or are named .yml and contain YAML data. So for the SimpleBackend clients may ... | def load_path; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_translations\n files = if File.directory?(@path)\n Dir[@path + '/**/*.yml']\n elsif File.file?(@path)\n detect_list_or_file @path\n else\n $stderr.puts 'No valid translation file given'\n []\n end\n ... | [
"0.61598873",
"0.6106891",
"0.6106891",
"0.6089461",
"0.5996335",
"0.5996335",
"0.5957018",
"0.58532643",
"0.5843913",
"0.5732151",
"0.54969555",
"0.54711854",
"0.5455898",
"0.5443114",
"0.5434977",
"0.54027766",
"0.5373866",
"0.53678334",
"0.534962",
"0.52857524",
"0.5283375... | 0.5185214 | 25 |
Sets the load path instance. Custom implementations are expected to behave like a Ruby Array. source://i18n//lib/i18n/config.rb132 | def load_path=(load_path); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loadpath=(list)\n @loadpath = makelist(list)\n end",
"def load_translations\n super(@load_paths)\n end",
"def load_translations\n super(@load_paths)\n end",
"def load_paths\n @load_paths ||= Config::LoadPaths.new\n end",
"def initialize(load_path: LOAD_PATH)\n ... | [
"0.6769355",
"0.6761703",
"0.6761703",
"0.6641526",
"0.6622645",
"0.6529562",
"0.6456223",
"0.6377205",
"0.6334327",
"0.62206495",
"0.6048509",
"0.59980035",
"0.59872425",
"0.5951372",
"0.5912234",
"0.5900734",
"0.5899993",
"0.58590525",
"0.5852497",
"0.5852497",
"0.57656765"... | 0.72574174 | 0 |
The only configuration value that is not global and scoped to thread is :locale. It defaults to the default_locale. source://i18n//lib/i18n/config.rb9 | def locale; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_locale\n AppConfig.default_locale\n end",
"def default_locale=(locale); end",
"def default_locale; end",
"def current_locale\n Thread.current[:\"localite:locale\"] || base\n end",
"def default_locale\n evaluate_localization_option!(:default_locale)\n end",
"def locale=(locale)... | [
"0.7460023",
"0.74554276",
"0.7307174",
"0.71970034",
"0.7192265",
"0.7185846",
"0.70501685",
"0.70155674",
"0.6964818",
"0.6962019",
"0.6868439",
"0.68397456",
"0.68173033",
"0.68173033",
"0.67999643",
"0.6784234",
"0.6784234",
"0.6738898",
"0.67383397",
"0.67383397",
"0.671... | 0.0 | -1 |
Sets the current locale pseudoglobally, i.e. in the Thread.current hash. source://i18n//lib/i18n/config.rb14 | def locale=(locale); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_locale\n return unless Language.current\n\n ::I18n.locale = Language.current&.locale\n end",
"def set_locale\n if current_user.blank?\n I18n.locale = valid_language\n logger.debug \"* Locale set to '#{I18n.locale}'\"\n else\n # TODO: Let user decide which language - to h... | [
"0.79651",
"0.7778035",
"0.7643022",
"0.76200086",
"0.75704306",
"0.7561668",
"0.7561668",
"0.75455534",
"0.74885684",
"0.74237764",
"0.7416121",
"0.73989516",
"0.73667914",
"0.7357776",
"0.7331059",
"0.7329447",
"0.7324575",
"0.7303647",
"0.72868264",
"0.72778463",
"0.720571... | 0.7084856 | 36 |
Returns the current handler for situations when interpolation argument is missing. MissingInterpolationArgument will be raised by default. source://i18n//lib/i18n/config.rb97 | def missing_interpolation_argument_handler; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def i18n\n return unless defined?(I18n)\n I18n.config.exception_handler = ->(exception, _locale, _key, _options) do\n raise exception.respond_to?(:to_exception) ? exception.to_exception : exception\n end\n end",
"def string_interpolation?(value = @value)\n !value.index(INTERPOLA... | [
"0.5517022",
"0.5260013",
"0.5257614",
"0.51578754",
"0.4976981",
"0.4906172",
"0.48765105",
"0.48153022",
"0.4802552",
"0.4802552",
"0.47337902",
"0.46863475",
"0.46790642",
"0.46790642",
"0.46781546",
"0.46509776",
"0.46246645",
"0.46230543",
"0.46203578",
"0.46012974",
"0.... | 0.68051827 | 0 |
returns an array of plural keys for the given locale or the whole hash of locale mappings to plural keys so that we can convert from gettext's integerindex based style TODO move this information to the pluralization module source://i18n//lib/i18n/gettext.rb17 | def plural_keys(*args); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def locales\n locale_counts.keys\n end",
"def get_count_keys(locale, key)\r\n empty_translations = {}\r\n store_empty_translations = false\r\n count_keys = I18n.t!('i18n.plural.keys', :locale => locale).inject({}) do |result, plural_key|\r\n full_key = \"#{key}.#{plural_key}\"\r... | [
"0.71368897",
"0.70412976",
"0.6803723",
"0.65343845",
"0.6320404",
"0.62752354",
"0.62734723",
"0.62097245",
"0.5986995",
"0.5933502",
"0.59183365",
"0.5905321",
"0.5882354",
"0.58422196",
"0.57963085",
"0.57963085",
"0.57725656",
"0.5732884",
"0.571899",
"0.57029855",
"0.56... | 0.6791306 | 3 |
Method signatures: npgettext('Fruits', 'apple', 'apples', 2) npgettext('Fruits', ['apple', 'apples'], 2) source://i18n//lib/i18n/gettext/helpers.rb61 | def np_(msgctxt, msgid, msgid_plural, n = T.unsafe(nil)); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def npgettext(msgctxt, msgid, msgid_plural, n = T.unsafe(nil)); end",
"def nsgettext(msgid, msgid_plural, n = T.unsafe(nil), separator = T.unsafe(nil)); end",
"def t(*args); I18n.t(*args) end",
"def n_(*msgids)\n count = msgids.pop\n \n translations = FastGettext.current_repository.plural(*msg... | [
"0.7873009",
"0.77218634",
"0.6509395",
"0.6392087",
"0.63138026",
"0.61900556",
"0.60633945",
"0.59617865",
"0.594882",
"0.59190375",
"0.5905709",
"0.5855841",
"0.5769643",
"0.57496667",
"0.57415915",
"0.5694004",
"0.56891274",
"0.5641658",
"0.56279945",
"0.5614263",
"0.5534... | 0.60368663 | 7 |
Method signatures: npgettext('Fruits', 'apple', 'apples', 2) npgettext('Fruits', ['apple', 'apples'], 2) source://i18n//lib/i18n/gettext/helpers.rb61 | def npgettext(msgctxt, msgid, msgid_plural, n = T.unsafe(nil)); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nsgettext(msgid, msgid_plural, n = T.unsafe(nil), separator = T.unsafe(nil)); end",
"def t(*args); I18n.t(*args) end",
"def n_(*msgids)\n count = msgids.pop\n \n translations = FastGettext.current_repository.plural(*msgids)\n selected = FastGettext.current_repository.pluralisation_rule.... | [
"0.7721742",
"0.6507781",
"0.63917255",
"0.6312333",
"0.6190085",
"0.6061964",
"0.60387564",
"0.5962843",
"0.5949399",
"0.59180874",
"0.5904026",
"0.58546674",
"0.5769935",
"0.5748329",
"0.57399404",
"0.569274",
"0.56877345",
"0.5640801",
"0.562679",
"0.5613142",
"0.55351084"... | 0.78737795 | 0 |
Method signatures: nsgettext('Fruits|apple', 'apples', 2) nsgettext(['Fruits|apple', 'apples'], 2) source://i18n//lib/i18n/gettext/helpers.rb46 | def ns_(msgid, msgid_plural, n = T.unsafe(nil), separator = T.unsafe(nil)); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nsgettext(msgid, msgid_plural, n = T.unsafe(nil), separator = T.unsafe(nil)); end",
"def npgettext(msgctxt, msgid, msgid_plural, n = T.unsafe(nil)); end",
"def l(*args); I18n.l(*args) end",
"def t(*args); I18n.t(*args) end",
"def n_(*msgids)\n count = msgids.pop\n \n translations = FastG... | [
"0.7581999",
"0.6791193",
"0.57829094",
"0.5727344",
"0.57247674",
"0.5641557",
"0.5438735",
"0.5438735",
"0.5438735",
"0.53590256",
"0.53401554",
"0.5300031",
"0.5284317",
"0.5276896",
"0.5264105",
"0.5264105",
"0.5264105",
"0.5250062",
"0.52473104",
"0.5198388",
"0.5198388"... | 0.6674116 | 2 |
Method signatures: nsgettext('Fruits|apple', 'apples', 2) nsgettext(['Fruits|apple', 'apples'], 2) source://i18n//lib/i18n/gettext/helpers.rb46 | def nsgettext(msgid, msgid_plural, n = T.unsafe(nil), separator = T.unsafe(nil)); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def npgettext(msgctxt, msgid, msgid_plural, n = T.unsafe(nil)); end",
"def ns_(msgid, msgid_plural, n = T.unsafe(nil), separator = T.unsafe(nil)); end",
"def l(*args); I18n.l(*args) end",
"def t(*args); I18n.t(*args) end",
"def n_(*msgids)\n count = msgids.pop\n \n translations = FastGettext... | [
"0.6792097",
"0.66764313",
"0.5781654",
"0.5726153",
"0.5725643",
"0.56406915",
"0.5438408",
"0.5438408",
"0.5438408",
"0.5358775",
"0.53412116",
"0.5301072",
"0.52857107",
"0.5277405",
"0.5263729",
"0.5263729",
"0.5263729",
"0.5251851",
"0.5247334",
"0.5197781",
"0.5197781",... | 0.75832784 | 0 |
Returns the value of attribute locale. source://i18n//lib/i18n/exceptions.rb33 | def locale; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def locale\r\n read_attribute(:locale).to_sym\r\n end",
"def locale\n return nil if errors\n\n locale = YAML.safe_load(@text).keys.first\n locale.to_sym\n end",
"def locale\n return @locale\n end",
"def locale\n return @locale\n end",
"d... | [
"0.754781",
"0.7252886",
"0.71678245",
"0.71678245",
"0.70410967",
"0.6866833",
"0.686631",
"0.68230784",
"0.6686969",
"0.6676696",
"0.66669863",
"0.66669863",
"0.66206306",
"0.6609035",
"0.65974677",
"0.65783453",
"0.651413",
"0.6511079",
"0.6511079",
"0.65004814",
"0.646107... | 0.65631115 | 21 |
Returns the value of attribute filename. source://i18n//lib/i18n/exceptions.rb41 | def filename; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filename\n raise\n end",
"def filename\n @properties[:filename]\n end",
"def getFilename\r\n\t\t\t\t\treturn @filename\r\n\t\t\t\tend",
"def filename\n @filename\n end",
"def filename\n @filename\n end",
"def filename\n @filename\n end",
"def file_nam... | [
"0.7426389",
"0.7015572",
"0.6760014",
"0.6714185",
"0.6708332",
"0.6708332",
"0.6622393",
"0.6622393",
"0.660398",
"0.65890926",
"0.658782",
"0.656798",
"0.6562609",
"0.6536921",
"0.65184313",
"0.6511762",
"0.6464005",
"0.6380086",
"0.6368738",
"0.6332088",
"0.63253725",
"... | 0.5944656 | 62 |
Returns the value of attribute count. source://i18n//lib/i18n/exceptions.rb93 | def count; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count\n @attributes['count']\n end",
"def count\n self[:count].to_i\n end",
"def count\n @obj['count'].to_i\n end",
"def size\n @errors.values.inject(0) { |error_count, attribute| error_count + attribute.size }\n end",
"def size\n @errors.values.inject(0) { |error_count, at... | [
"0.7390349",
"0.6595475",
"0.65658665",
"0.6517863",
"0.6478921",
"0.6478921",
"0.64198375",
"0.63121897",
"0.630374",
"0.62723786",
"0.61698264",
"0.6154641",
"0.6109414",
"0.60031146",
"0.5980089",
"0.5979875",
"0.5953739",
"0.59236264",
"0.5923555",
"0.59062064",
"0.588713... | 0.53897506 | 99 |
Returns the value of attribute entry. source://i18n//lib/i18n/exceptions.rb93 | def entry; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def value\n raise\n end",
"def get_attribute_value(attribute)\n data[attribute]\n end",
"def get_entry(entry); end",
"def get(value)\n if value.kind_of? Details::Attribute\n raise \"Invalid attribute! Must be an attribute named #{self.name}\" if value.name != self.name\n ... | [
"0.5892803",
"0.5808762",
"0.5786461",
"0.57092917",
"0.56783736",
"0.5650231",
"0.56321627",
"0.56321627",
"0.56076485",
"0.5597559",
"0.5581199",
"0.55504876",
"0.5535299",
"0.55233335",
"0.55131596",
"0.549386",
"0.54874265",
"0.54667634",
"0.5452716",
"0.54484504",
"0.543... | 0.0 | -1 |
Returns the value of attribute key. source://i18n//lib/i18n/exceptions.rb93 | def key; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def key\n attributes['key'] or raise NoKeySpecified\n end",
"def get_message(key)\n msg = error_messages[key]\n return msg.nil? ? 'An unspecified error occurred.' : msg\n end",
"def key_value\n @attrs[self.class.key_attribute.to_s]\nend",
"def _read_attribute(key); end",
"def key_valu... | [
"0.6568146",
"0.65384245",
"0.6519964",
"0.6504203",
"0.6498144",
"0.6497692",
"0.64802617",
"0.6449955",
"0.63199526",
"0.63199526",
"0.6286971",
"0.61781454",
"0.61704075",
"0.61315423",
"0.6129793",
"0.6129793",
"0.61205995",
"0.6113616",
"0.60509425",
"0.5977679",
"0.5977... | 0.0 | -1 |
Returns the value of attribute defaults. source://i18n//lib/i18n/locale/fallbacks.rb58 | def defaults; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_value\n self['default']\n end",
"def fallback_to_default(localization_key, localization)\n localization_key.localizations.where.not(default_value: nil). \\\n where.not(id: localization.id).first&.default_value\n end",
"def default_value\n match = if definition =~ /ti... | [
"0.6742151",
"0.66488904",
"0.6500617",
"0.63341075",
"0.6249136",
"0.61659443",
"0.61448073",
"0.61326814",
"0.6073066",
"0.60408926",
"0.60327405",
"0.6030849",
"0.60234493",
"0.6019798",
"0.60092217",
"0.6008043",
"0.59888434",
"0.5984335",
"0.59819263",
"0.59415054",
"0.5... | 0.56252855 | 84 |
Sets the current locale tag implementation. Use this to set a different locale tag implementation. source://i18n//lib/i18n/locale/tag.rb17 | def implementation=(implementation); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_tag(tag, value, span=nil)\n raise NotImplementedError\n end",
"def language_tag=(value)\n @language_tag = value\n end",
"def tag_text=(value)\n self.tag=(value)\n end",
"def tag=(tag)\n @tag = tag\n @tls_id ||= \"tag_logger_#{self.object_id}\"\n ... | [
"0.61636746",
"0.6154581",
"0.5762692",
"0.5741483",
"0.56934136",
"0.5678227",
"0.566441",
"0.5632511",
"0.5631688",
"0.5631688",
"0.5631688",
"0.5631688",
"0.5631688",
"0.5631688",
"0.5631688",
"0.5550988",
"0.5465668",
"0.5465668",
"0.53963137",
"0.5390357",
"0.5390357",
... | 0.0 | -1 |
Factory method for locale tags. Delegates to the current locale tag implementation. source://i18n//lib/i18n/locale/tag.rb22 | def tag(tag); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def langtag(locale)\n\t\tcase locale.to_s\n\t\twhen 'se' then 'se'\n\t\twhen 'us' then 'en'\n\t\twhen 'uk' then 'en'\n\t\twhen 'cn' then 'zh'\n\t\telse locale\n\t\tend\n\tend",
"def factory_method_for(tag); end",
"def tag_names locale = :en\n tags.pluck(\"name_#{locale}\").uniq.join(', ')\n end",
... | [
"0.6808841",
"0.5990548",
"0.58918536",
"0.57097554",
"0.55515933",
"0.5514053",
"0.5505078",
"0.54841197",
"0.5483733",
"0.547594",
"0.54700255",
"0.54700255",
"0.5469505",
"0.54685724",
"0.5443215",
"0.5413555",
"0.53936845",
"0.53820074",
"0.5370707",
"0.53667915",
"0.5353... | 0.56099695 | 5 |
Parses the given tag and returns a Tag instance if it is valid. Returns false if the given tag is not valid according to RFC 4646. source://i18n//lib/i18n/locale/tag/rfc4646.rb18 | def tag(tag); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_tag(tag)\n parser = REXML::Parsers::UltraLightParser.new( tag)\n parser.parse[0]\n end",
"def is_lang_tag? m\n I18n::Locale::Tag::Rfc4646.tag m rescue false\n end",
"def is_lang_tag? m\n I18n::Locale::Tag::Rfc4646.tag m rescue false\n end",
"def parse_tag\n a_ord = ?a\n ... | [
"0.71589494",
"0.65725255",
"0.65725255",
"0.6411111",
"0.6313324",
"0.62935996",
"0.62114143",
"0.6185384",
"0.6144448",
"0.60811335",
"0.5932906",
"0.5924055",
"0.58369875",
"0.58241624",
"0.5820324",
"0.56992096",
"0.5663235",
"0.56374204",
"0.56203073",
"0.55995494",
"0.5... | 0.52961195 | 37 |
Returns the value of attribute tag. source://i18n//lib/i18n/locale/tag/simple.rb15 | def tag; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def value_for_tag(tag)\n self.__send__(fields[tag].name)\n end",
"def get_tag_value(key)\n get_tag(key).try(:tag_value).try(:value)\n end",
"def first_value(tag)\n tag_summary(tag).first[1].first\n end",
"def [](tag)\n unified_tag = Values.unify_tag(tag)\n convert(unified_tag,... | [
"0.6936106",
"0.6442283",
"0.64139587",
"0.6313943",
"0.62984896",
"0.62946063",
"0.6169126",
"0.61559546",
"0.61121285",
"0.61073935",
"0.61013216",
"0.6090771",
"0.6084936",
"0.6053683",
"0.60321325",
"0.6011387",
"0.6006891",
"0.5995697",
"0.59869564",
"0.5985908",
"0.5947... | 0.0 | -1 |
Returns the value of attribute key. source://i18n//lib/i18n/exceptions.rb101 | def key; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def key_value\n @attrs[self.class.key_attribute.to_s]\nend",
"def get_message(key)\n msg = error_messages[key]\n return msg.nil? ? 'An unspecified error occurred.' : msg\n end",
"def key\n attributes['key'] or raise NoKeySpecified\n end",
"def _read_attribute(key); end",
"def read_att... | [
"0.6537088",
"0.6531893",
"0.6525233",
"0.6521474",
"0.6490372",
"0.6469063",
"0.6463172",
"0.6429756",
"0.6308918",
"0.6308918",
"0.6267189",
"0.6199822",
"0.6159743",
"0.6142727",
"0.61229026",
"0.61229026",
"0.6122393",
"0.61192036",
"0.6039653",
"0.5970389",
"0.5970389",
... | 0.0 | -1 |
Returns the value of attribute string. source://i18n//lib/i18n/exceptions.rb101 | def string; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_string(attr); end",
"def get_value(attribute)\n obj = @map[attribute]\n if obj\n if obj.is_a?(String)\n return obj.to_s\n end\n end\n\n raise IllegalStateException, \"The attribute #{attribute} doesn't have a paired string.\"\n end",
"def ge... | [
"0.6990498",
"0.63566935",
"0.6330076",
"0.6227711",
"0.6198186",
"0.6198186",
"0.6159626",
"0.6018299",
"0.60011744",
"0.5947088",
"0.5926198",
"0.5907302",
"0.58926356",
"0.5874215",
"0.58702123",
"0.584288",
"0.5828314",
"0.5736146",
"0.57326406",
"0.5714403",
"0.5712049",... | 0.0 | -1 |
Returns the value of attribute values. source://i18n//lib/i18n/exceptions.rb101 | def values; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exceptions\n @values['exceptions']\n end",
"def attribute_errors\n errors = []\n self.class.all_attrs.values.each do |attr|\n attr.error_messages(attributes[attr.name]).each do |message|\n errors << \"#{to_s} #{message}\"\n end\n end\n ... | [
"0.68621975",
"0.6014565",
"0.5986756",
"0.5940006",
"0.590028",
"0.58686674",
"0.58294743",
"0.57989454",
"0.5791069",
"0.5759251",
"0.57191104",
"0.5704403",
"0.5681387",
"0.5681387",
"0.5680825",
"0.5674279",
"0.5648006",
"0.56090575",
"0.5607465",
"0.5607465",
"0.56039923... | 0.0 | -1 |
Returns the value of attribute key. source://i18n//lib/i18n/exceptions.rb52 | def key; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def key\n attributes['key'] or raise NoKeySpecified\n end",
"def key_value\n @attrs[self.class.key_attribute.to_s]\nend",
"def _read_attribute(key); end",
"def get_message(key)\n msg = error_messages[key]\n return msg.nil? ? 'An unspecified error occurred.' : msg\n end",
"def key_valu... | [
"0.6566014",
"0.65287936",
"0.6526084",
"0.6514951",
"0.65076464",
"0.64971024",
"0.64884686",
"0.6451801",
"0.6315732",
"0.6315732",
"0.6285044",
"0.6172765",
"0.6160449",
"0.6133987",
"0.6130529",
"0.6130529",
"0.61150324",
"0.6101438",
"0.60496014",
"0.59742546",
"0.597425... | 0.0 | -1 |
Returns the value of attribute locale. source://i18n//lib/i18n/exceptions.rb52 | def locale; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def locale\r\n read_attribute(:locale).to_sym\r\n end",
"def locale\n return nil if errors\n\n locale = YAML.safe_load(@text).keys.first\n locale.to_sym\n end",
"def locale\n return @locale\n end",
"def locale\n return @locale\n end",
"d... | [
"0.7582414",
"0.72378975",
"0.7186267",
"0.7186267",
"0.7050338",
"0.68463755",
"0.68450034",
"0.68023676",
"0.6683615",
"0.66830313",
"0.66830313",
"0.6653649",
"0.66487956",
"0.6629406",
"0.6610411",
"0.6580387",
"0.6554843",
"0.6554843",
"0.65383667",
"0.6520241",
"0.65023... | 0.65556216 | 20 |
Returns the value of attribute options. source://i18n//lib/i18n/exceptions.rb52 | def options; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_s\n \"Option :#{@option_name} is not a recognised option.\"\n end",
"def options\n attributes.fetch(:options)\n end",
"def value\r\n assert_exists\r\n option_value\r\n end",
"def options_text\n options.map{ |opt| opt.text}\n end",
"def error(a... | [
"0.61152637",
"0.6095615",
"0.6036085",
"0.60175234",
"0.6016837",
"0.5911173",
"0.5905528",
"0.5888331",
"0.5834185",
"0.5815595",
"0.57814837",
"0.5735032",
"0.5728902",
"0.5703877",
"0.56964666",
"0.568494",
"0.5623765",
"0.558237",
"0.55760247",
"0.5574",
"0.5513959",
"... | 0.0 | -1 |
Returns the value of attribute key. source://i18n//lib/i18n/exceptions.rb109 | def key; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def key\n attributes['key'] or raise NoKeySpecified\n end",
"def key_value\n @attrs[self.class.key_attribute.to_s]\nend",
"def _read_attribute(key); end",
"def get_message(key)\n msg = error_messages[key]\n return msg.nil? ? 'An unspecified error occurred.' : msg\n end",
"def key_valu... | [
"0.6561134",
"0.6527371",
"0.65238667",
"0.6515823",
"0.6510158",
"0.6481626",
"0.64718825",
"0.6430067",
"0.62943554",
"0.62943554",
"0.6255954",
"0.61909246",
"0.6172352",
"0.61207014",
"0.6112885",
"0.6112885",
"0.61048526",
"0.60806817",
"0.603959",
"0.5967862",
"0.596221... | 0.0 | -1 |
Returns the value of attribute string. source://i18n//lib/i18n/exceptions.rb109 | def string; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_string(attr); end",
"def get_string_value\n\t\tend",
"def get_value(attribute)\n obj = @map[attribute]\n if obj\n if obj.is_a?(String)\n return obj.to_s\n end\n end\n\n raise IllegalStateException, \"The attribute #{attribute} doesn't have a pair... | [
"0.69891775",
"0.63351744",
"0.6315944",
"0.62282073",
"0.6220859",
"0.61755294",
"0.61755294",
"0.60254234",
"0.5971157",
"0.5960759",
"0.5945387",
"0.589549",
"0.58895236",
"0.58698446",
"0.5842314",
"0.58374757",
"0.5820371",
"0.5733058",
"0.57262313",
"0.57200474",
"0.571... | 0.0 | -1 |
Returns the value of attribute filename. source://i18n//lib/i18n/exceptions.rb117 | def filename; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filename\n raise\n end",
"def filename\n @properties[:filename]\n end",
"def getFilename\r\n\t\t\t\t\treturn @filename\r\n\t\t\t\tend",
"def filename\n @filename\n end",
"def filename\n @filename\n end",
"def filename\n @filename\n end",
"def file_nam... | [
"0.7384743",
"0.70630807",
"0.680468",
"0.6748212",
"0.67416143",
"0.67416143",
"0.66735876",
"0.66735876",
"0.664797",
"0.66358054",
"0.6629167",
"0.66220355",
"0.6609552",
"0.65783286",
"0.65663797",
"0.6563168",
"0.6502247",
"0.6419557",
"0.6419504",
"0.63743913",
"0.63688... | 0.59795827 | 62 |
Returns the value of attribute type. source://i18n//lib/i18n/exceptions.rb117 | def type; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def type\n @attributes[:type]\n end",
"def type\n @attributes[:type]\n end",
"def type\n @attributes[:type]\n end",
"def type\n @attributes[:type]\n end",
"def type\n attr_val('./@typeCode')\n end",
"def failure_type\n @attributes[:failure_type]\n end",
"def ... | [
"0.67965454",
"0.6758143",
"0.6758143",
"0.6758143",
"0.66248244",
"0.66092944",
"0.6570114",
"0.64820665",
"0.64709496",
"0.6451648",
"0.6443759",
"0.6443188",
"0.6399244",
"0.63964474",
"0.63953704",
"0.63598096",
"0.6338912",
"0.629534",
"0.626897",
"0.61901724",
"0.618876... | 0.0 | -1 |
Returns the value of attribute backend_klass. source://i18n//lib/i18n/exceptions.rb125 | def backend_klass; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inspect\n \"Inspec::Backend::Class @transport=#{backend.class}\"\n end",
"def klass\n class_name = self[\"_type\"]\n class_name ? class_name.constantize : nil\n end",
"def klass\n @klass ||= begin\n @klass_name.split('::').inject(Object){|n,i| n.const_get(i)}\n ... | [
"0.6439473",
"0.6364077",
"0.6353455",
"0.62631845",
"0.6179496",
"0.61606276",
"0.61606276",
"0.6159273",
"0.61586124",
"0.60690385",
"0.60690385",
"0.60690385",
"0.6047836",
"0.60435575",
"0.6043083",
"0.6015774",
"0.6010699",
"0.5976511",
"0.597107",
"0.5953714",
"0.591720... | 0.72675484 | 0 |
Returns the value of attribute method. source://i18n//lib/i18n/exceptions.rb125 | def method; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def [](attribute)\n messages_for(attribute)\n end",
"def [](attribute)\n messages[attribute.to_sym]\n end",
"def attribute_get(attribute)\n check_attribute!(attribute)\n send(attribute.to_s)\n end",
"def attribute_get(attribute)\n check_attribute!(attribute)\n send(attribute.to_s... | [
"0.6290639",
"0.62029237",
"0.6152934",
"0.6152934",
"0.6089394",
"0.6089394",
"0.6059173",
"0.6057837",
"0.6054255",
"0.6027787",
"0.6012341",
"0.5954264",
"0.5933237",
"0.5933237",
"0.5892689",
"0.5892574",
"0.5868998",
"0.58081543",
"0.5806475",
"0.5799586",
"0.5787982",
... | 0.0 | -1 |
Returns the value of attribute msg. source://i18n//lib/i18n/exceptions.rb125 | def msg; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_message(key)\n msg = error_messages[key]\n return msg.nil? ? 'An unspecified error occurred.' : msg\n end",
"def exception_message\n @e_m ||= @exception.nil? ? '' : @exception.message\n end",
"def message\n @error['message']\n end",
"def error_message\n self[:error_messa... | [
"0.7317678",
"0.7084888",
"0.70647895",
"0.69148684",
"0.6891388",
"0.68525314",
"0.6843268",
"0.68404174",
"0.6804894",
"0.6769956",
"0.67391574",
"0.66558814",
"0.6554872",
"0.65408057",
"0.65241593",
"0.6430584",
"0.6408233",
"0.6365566",
"0.63168323",
"0.62989503",
"0.629... | 0.0 | -1 |
Generates crontab for each scheduled Job using Whenever DSL. | def schedule_jobs(job_list)
Jobbr::Ohm.models(Jobbr::Scheduled).each do |job|
if job.every
job_list.every job.every[0], job.every[1] do
job_list.jobbr job.task_name
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def install_crontab\n # create a working crontab file\n # log \"Building crontab\\n\"\n f = File.open(CRONTAB, 'w')\n f.write \"MAIL='keburgett@gmail.com'\\n\"\n # for each sprinkle, write a crontab entry for OPEN and CLOSE times.\n p = Porter.first.localhost_with_port # provides host:port combin... | [
"0.71155566",
"0.70647675",
"0.6726734",
"0.66560173",
"0.6329746",
"0.6241412",
"0.61797154",
"0.61311436",
"0.6067103",
"0.60323566",
"0.6022563",
"0.5953872",
"0.58901006",
"0.58551264",
"0.5836398",
"0.58332103",
"0.579289",
"0.5760674",
"0.5750348",
"0.57358044",
"0.5721... | 0.622361 | 6 |
Write a method called 'in_array' which will take two parameteres: One as a string and one as an array of strings Return a boolean indicationg whether or not the string is found in the array. Test your solution with: ruby tests/05_in_array_test.rb Example: "hello", ["hi","howdy","hello"] should return true. Defining met... | def in_array(needle, haystack)
(string_in_array(needle, haystack) == true and needle.is_a? String) ? true : false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def in_array(array, string)\n array.each do |object|\n if object == string\n return true\n else\n return false\n end\n end\nend",
"def is_it_in(array, string)\n array.include?(string) ? array.index(string) : nil\nend",
"def arr_in_phrase? (arr, string)\n\t#might be unefficient to recrea... | [
"0.7816119",
"0.74933344",
"0.74730855",
"0.74123037",
"0.7315693",
"0.7283202",
"0.72668666",
"0.7142964",
"0.7074229",
"0.7035094",
"0.70348394",
"0.70124453",
"0.70107067",
"0.6939859",
"0.6839054",
"0.6736855",
"0.67250067",
"0.6700291",
"0.66987336",
"0.6493552",
"0.6489... | 0.8270633 | 0 |
For current implementation docs, see For upcoming XML implementation docs, see | def price
@required = [:zip, :country, :sender_zip, :weight]
@insured_value ||= 0
@country ||= 'US'
@sender_country ||= 'US'
@transaction_type ||= 'GND' # default to UPS ground
@data = "AppVersion=1.2&AcceptUPSLicenseAgreement=yes&ResponseType=application/x-... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def xml?; end",
"def xml?; end",
"def xml; end",
"def xml_decl; end",
"def parse_xml\n\n raise \"parse_xml method has not been implemented in this class\"\n \n end",
"def render_xml\n end",
"def build_xml\n raise NotImplementedError, \"Override build_xml in subclass\"\n ... | [
"0.7317029",
"0.7317029",
"0.71309465",
"0.6866044",
"0.66011095",
"0.6576617",
"0.65291077",
"0.6490636",
"0.64841795",
"0.6471499",
"0.64376557",
"0.6363155",
"0.6363155",
"0.6310148",
"0.6310148",
"0.62645566",
"0.6193281",
"0.61876607",
"0.61783147",
"0.61626214",
"0.6120... | 0.0 | -1 |
See for API info | def valid_address?( delta = 1.0 )
@required = [:ups_account, :ups_user, :ups_password]
state = STATES.has_value?(@state.downcase) ? STATES.index(@state.downcase) : @state
@data = String.new
b = Builder::XmlMarkup.new :target => @data
b.instruct!... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apis; end",
"def api; end",
"def api; end",
"def info\n get(\"/api-info\")\n end",
"def api_mode; end",
"def inspect\n return 'Ballchasing API'\n end",
"def api\n @api\n end",
"def api_only; end",
"def api_only; end",
"def api_only; end",
"def getinfo\n @api.reque... | [
"0.7917624",
"0.7724827",
"0.7724827",
"0.74854916",
"0.74843943",
"0.7421503",
"0.73053926",
"0.7287437",
"0.7287437",
"0.7287437",
"0.7141845",
"0.70885766",
"0.70866466",
"0.70270675",
"0.70270675",
"0.6946844",
"0.69116867",
"0.69116867",
"0.68987346",
"0.6865924",
"0.686... | 0.0 | -1 |
block caller until lock is aquired, then yield | def with_lock
lock!(true)
yield
ensure
unlock!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def with_lock\n lock\n begin\n yield if block_given?\n ensure\n unlock\n end\n end",
"def synchronize\n lock\n yield\n ensure\n unlock\n end",
"def synchronize # :yields:\n lock\n yield\n ensure\n unlock\n end",
"def synchronize\n lock... | [
"0.8058668",
"0.76484823",
"0.7619658",
"0.7459504",
"0.74217576",
"0.7381096",
"0.7303057",
"0.72804105",
"0.72804105",
"0.72804105",
"0.72804105",
"0.72190434",
"0.71801776",
"0.71436113",
"0.71273816",
"0.71096826",
"0.7001381",
"0.6898819",
"0.6898819",
"0.6898819",
"0.68... | 0.811213 | 0 |
the basename of our lock path for the lock_path '/_zklocking/foobar/__blah/lock000000007' lock_basename is 'lock000000007' returns nil if lock_path is not set | def lock_basename
lock_path and File.basename(lock_path)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lockfile_basename\n \"sync-#{syncer_name}.lock\"\n end",
"def lock_path\n File.join(lock_dir,\"Kellerkind.lock\")\n end",
"def lock_path; end",
"def lockfile_path\n return unless gemfile_path\n @lockfile_path ||= gemfile_path.dirname.join(\"#{gemfile_path.basename}.lock\... | [
"0.6698864",
"0.6475923",
"0.64210224",
"0.64033467",
"0.621156",
"0.6184906",
"0.600972",
"0.5983802",
"0.59661984",
"0.59616673",
"0.5881011",
"0.58205074",
"0.5798359",
"0.578139",
"0.5766341",
"0.56991315",
"0.5672897",
"0.5625355",
"0.56149566",
"0.55898243",
"0.5580524"... | 0.81779593 | 0 |
returns true if this locker is waiting to acquire lock | def waiting? #:nodoc:
false|@waiting
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_locked?\n return true if have_lock?\n begin\n return true unless acquire_lock\n ensure\n release_lock\n end\n false\n end",
"def waiting?\n @lock.synchronize { !defined?(@start_time) }\n end",
"def update_startlock?\r\n # When waiting for event execut... | [
"0.7796324",
"0.7723958",
"0.76213855",
"0.7547219",
"0.75395447",
"0.7463722",
"0.743583",
"0.74192744",
"0.74141484",
"0.7384949",
"0.7359922",
"0.73179096",
"0.7313366",
"0.73017013",
"0.72940284",
"0.7290264",
"0.7290264",
"0.7225394",
"0.7203514",
"0.7185347",
"0.7130378... | 0.7277358 | 17 |
prefix is the string that will appear in front of the sequence num, defaults to 'lock' | def create_lock_path!(prefix='lock')
@lock_path = @zk.create("#{root_lock_path}/#{prefix}", "", :mode => :ephemeral_sequential)
logger.debug { "got lock path #{@lock_path}" }
@lock_path
rescue Exceptions::NoNode
create_root_path!
retry
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prefix(num)\n namespace + '_prefix_' + num.to_s\n end",
"def key_prefix\n \"number\"\n end",
"def next_part_with_prefix(prefix, suffix)\n num = @parts.select { |n, _| n.start_with?(prefix) && n.end_with?(suffix) }\n .map { |n, _| n[prefix.length..-1][0..-(suffix.siz... | [
"0.68285567",
"0.65408534",
"0.6394521",
"0.63607705",
"0.6357636",
"0.63000584",
"0.62710446",
"0.62710446",
"0.62710446",
"0.62710446",
"0.62710446",
"0.62710446",
"0.62710446",
"0.62710446",
"0.62710446",
"0.62710446",
"0.6212062",
"0.618934",
"0.6136409",
"0.6078622",
"0.... | 0.0 | -1 |
returns the sequence number of the next lowest write lock node raises NoWriteLockFoundException when there are no write nodes with a sequence less than ours | def next_lowest_write_lock_num #:nodoc:
digit_from(next_lowest_write_lock_name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_lowest_write_lock_num\n digit_from(next_lowest_write_lock_name)\n end",
"def next_lowest_write_lock_name\n ary = ordered_lock_children()\n my_idx = ary.index(lock_basename) # our idx would be 2\n\n ary[0..my_idx].reverse.find { |n| n.start_with?(EXCLUSIVE_LOCK_PREFIX) ... | [
"0.796564",
"0.7624367",
"0.7462293",
"0.7143519",
"0.6344001",
"0.60185",
"0.6001479",
"0.5832082",
"0.5823021",
"0.5794594",
"0.57213014",
"0.5692753",
"0.5692438",
"0.5651834",
"0.5635214",
"0.5607697",
"0.55554646",
"0.5539939",
"0.55361444",
"0.54989177",
"0.54843944",
... | 0.79211247 | 1 |
the next lowest write lock number to ours so if we're "read010" and the children of the lock node are: %w[write008 write009 read010 read011] then this method will return write009 raises NoWriteLockFoundException if there were no write nodes with an index lower than ours | def next_lowest_write_lock_name #:nodoc:
ary = ordered_lock_children()
my_idx = ary.index(lock_basename) # our idx would be 2
not_found = lambda { raise NoWriteLockFoundException }
ary[0..my_idx].reverse.find(not_found) { |n| n =~ /^#{EXCLUSIVE_LOCK_PREFIX}/ }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_lowest_write_lock_name\n ary = ordered_lock_children()\n my_idx = ary.index(lock_basename) # our idx would be 2\n\n ary[0..my_idx].reverse.find { |n| n.start_with?(EXCLUSIVE_LOCK_PREFIX) }.tap do |rv|\n raise NoWriteLockFoundException if rv.nil?\n end\n end",
... | [
"0.79830515",
"0.788099",
"0.78305125",
"0.6740962",
"0.5577099",
"0.54548454",
"0.5447671",
"0.5374773",
"0.5318778",
"0.5118336",
"0.50976884",
"0.5096156",
"0.49826834",
"0.49427113",
"0.4917019",
"0.48869357",
"0.48385802",
"0.48154387",
"0.4769437",
"0.4744325",
"0.47083... | 0.7865699 | 2 |
TODO: make this generic, can either block or nonblock | def block_until_read_lock!
begin
path = [root_lock_path, next_lowest_write_lock_name].join('/')
logger.debug { "SharedLocker#block_until_read_lock! path=#{path.inspect}" }
@zk.block_until_node_deleted(path)
rescue NoWriteLockFoundException
# next_lowes... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end"... | [
"0.78133965",
"0.78133965",
"0.78133965",
"0.78133965",
"0.78133965",
"0.78133965",
"0.78133965",
"0.78133965",
"0.78133965",
"0.78133965",
"0.78133965",
"0.78133965",
"0.78133965",
"0.78133965",
"0.78133965",
"0.78133965",
"0.78133965",
"0.78133965",
"0.78133965",
"0.78133965"... | 0.0 | -1 |
the node that is nextlowest in sequence number to ours, the one we watch for updates to | def next_lowest_node
ary = ordered_lock_children()
my_idx = ary.index(lock_basename)
raise WeAreTheLowestLockNumberException if my_idx == 0
ary[(my_idx - 1)]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_start_node\n return @nodes.reduce{|sum, pair| pair[0] < sum[0] ? pair : sum}[1] \n end",
"def first\n @head.lru_next\n end",
"def next_node\n @SuccessorReference.value\n end",
"def node_first\n @head\n end",
"def min\n @nodes.first\n end",
"def next(num)\... | [
"0.63810354",
"0.62072104",
"0.61714005",
"0.6124966",
"0.6106693",
"0.6052942",
"0.602598",
"0.6001068",
"0.59761685",
"0.59524286",
"0.5914708",
"0.590137",
"0.58750546",
"0.5847874",
"0.5839853",
"0.5834481",
"0.58116263",
"0.57894397",
"0.5781323",
"0.5772019",
"0.5763339... | 0.6022885 | 7 |
Testing password complexity for dat securitayyy | def password_complexity
return if password.blank? || password =~ /^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9]).{8,20}$/
errors.add :password, 'Password complexity requirement not met.'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def password_complexity\n if password.present? and not password.match(/\\A(?=.*[a-z])(?=.*[A-Z])(?=.*\\d).*/)\n errors.add :password, I18n.t('weak_password')\n end\n end",
"def password_complexity\n if password.present? and not password.match('^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[$@$!%*?&#]).{8,}... | [
"0.7701583",
"0.75790644",
"0.75339276",
"0.75182414",
"0.75172895",
"0.73275155",
"0.7224962",
"0.72051704",
"0.71196306",
"0.70846075",
"0.70819974",
"0.70616686",
"0.7053988",
"0.698081",
"0.69537574",
"0.693175",
"0.6907298",
"0.68338525",
"0.68187827",
"0.67965794",
"0.6... | 0.7872143 | 0 |
Escape bytea values. Uses historical format instead of hex format for maximum compatibility. | def escape_bytea(str)
# each_byte used instead of [] for 1.9 compatibility
str.gsub(/[\000-\037\047\134\177-\377]/n){|b| "\\#{sprintf('%o', b.each_byte{|x| break x}).rjust(3, '0')}"}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bytea(value)\n \"'\\\\x#{value.unpack1('H*')}'::bytea\"\n end",
"def quote_binary(v)\n X_AND_SINGLE_QUOTE + v.unpack(\"H*\")[0] + SINGLE_QUOTE\n end",
"def quote_binary(v)\n X_AND_SINGLE_QUOTE + v.unpack(\"H*\")[0] + SINGLE_QUOTE\n end",
"def quote_binary(v)\n X_A... | [
"0.6670051",
"0.6374127",
"0.6374127",
"0.6338109",
"0.6279088",
"0.6274744",
"0.61785936",
"0.6166857",
"0.61466247",
"0.6128632",
"0.60658073",
"0.6060971",
"0.59690356",
"0.589262",
"0.5851431",
"0.58511394",
"0.58188415",
"0.58101386",
"0.5790922",
"0.5764202",
"0.5746119... | 0.7547868 | 0 |
Escape strings by doubling apostrophes. This only works if standard conforming strings are used. | def escape_string(str)
str.gsub("'", "''")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def escape(input); input.to_s.gsub('\"', '\\\\\"'); end",
"def qesc(s)\n s.gsub(\"'\", \"''\")\nend",
"def shell_escape(s)\n s = s.to_s\n if s !~ /^[0-9A-Za-z+,.\\/:=@_-]+$/\n s = s.gsub(\"'\") { \"'\\\\''\" }\n s = \"'#{s}'\"\n end\n s\n end",
"def quote_str(s)\n ... | [
"0.7722508",
"0.7642704",
"0.7585502",
"0.7551453",
"0.7524091",
"0.7514853",
"0.75065154",
"0.747003",
"0.745325",
"0.74331826",
"0.74293447",
"0.7424182",
"0.7401624",
"0.7389724",
"0.7354956",
"0.7320594",
"0.73129207",
"0.7294251",
"0.7289715",
"0.7284854",
"0.7272765",
... | 0.76568407 | 1 |
Execute the given SQL with this connection. If a block is given, yield the results, otherwise, return the number of changed rows. | def execute(sql, args=nil)
args = args.map{|v| @db.bound_variable_arg(v, self)} if args
q = check_disconnect_errors{execute_query(sql, args)}
begin
block_given? ? yield(q) : q.cmd_tuples
ensure
q.clear if q && q.respond_to?(:clear)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _execute(conn, sql, opts)\n stmt = log_connection_yield(sql, conn){conn.execute(sql)}\n if block_given?\n yield(stmt)\n else \n stmt.affected\n end\n ensure\n stmt.free if stmt\n end",
"def execute_all( sql ) # :yields: row\n loop do\n ... | [
"0.695509",
"0.6553263",
"0.6432515",
"0.6257274",
"0.62539184",
"0.624179",
"0.6214166",
"0.614379",
"0.611238",
"0.6103601",
"0.6085855",
"0.6078134",
"0.6071048",
"0.6059197",
"0.6017211",
"0.6016044",
"0.59675395",
"0.59508336",
"0.5934793",
"0.5862775",
"0.5843922",
"0... | 0.60827494 | 11 |
Return the PGResult object that is returned by executing the given sql and args. | def execute_query(sql, args)
@db.log_connection_yield(sql, self, args){args ? async_exec(sql, args) : async_exec(sql)}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute\n result = nil\n ActiveRecord::Base.connection_pool.with_connection do |con|\n result = con.execute(to_sql)\n end\n if @sql_returning.nil?\n nil\n else\n if @returning_flat\n result.values.map{|r| r.first}\n else\n result\n e... | [
"0.7122949",
"0.69058275",
"0.6898071",
"0.6690125",
"0.65527105",
"0.6494794",
"0.64539707",
"0.6427724",
"0.6418019",
"0.62747717",
"0.62501246",
"0.62494457",
"0.62494457",
"0.6215481",
"0.6181223",
"0.61786216",
"0.6139155",
"0.61268324",
"0.61180377",
"0.61159366",
"0.60... | 0.5912038 | 26 |
Convert given argument so that it can be used directly by pg. Currently, pg doesn't handle fractional seconds in Time/DateTime or blobs with "\0", and it won't ever handle Sequel::SQLTime values correctly. Only public for use by the adapter, shouldn't be used by external code. | def bound_variable_arg(arg, conn)
case arg
when Sequel::SQL::Blob
{:value=>arg, :type=>17, :format=>1}
when Sequel::SQLTime
literal(arg)
when DateTime, Time
literal(arg)
else
arg
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_for_timestamp_shape(arg)\n return nil if arg.nil?\n\n time_value = case arg\n when Time\n arg\n when Date, DateTime\n arg.to_time\n when Integer, Float\n Time.at(arg)\n else\n Time.parse(arg.to_s)\n end\n time_value.utc... | [
"0.64404684",
"0.6386962",
"0.61356",
"0.5956805",
"0.592637",
"0.59039587",
"0.58744115",
"0.5859715",
"0.582636",
"0.5805587",
"0.5797189",
"0.57115",
"0.5707423",
"0.57020915",
"0.566127",
"0.55909127",
"0.55830276",
"0.55764776",
"0.5537971",
"0.55216724",
"0.55148417",
... | 0.6654411 | 0 |
Connects to the database. In addition to the standard database options, using the :encoding or :charset option changes the client encoding for the connection, :connect_timeout is a connection timeout in seconds, :sslmode sets whether postgres's sslmode, and :notice_receiver handles server notices in a proc. :connect_ti... | def connect(server)
opts = server_opts(server)
if USES_PG
connection_params = {
:host => opts[:host],
:port => opts[:port] || 5432,
:dbname => opts[:database],
:user => opts[:user],
:password => opts[:password],
:connect_t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connect\n PG::Connection.new(:host => host, :port => port, :user => user, :password => password, :sslmode => sslmode, :dbname => dbname)\n end",
"def initialize options\n host = options['host'] || 'localhost'\n port = options['port'] || 5432\n database = options['database']\n ... | [
"0.73320276",
"0.70448613",
"0.7007973",
"0.69815606",
"0.6863588",
"0.6848689",
"0.6848689",
"0.68261606",
"0.6744137",
"0.67378205",
"0.67165136",
"0.66200817",
"0.6610611",
"0.6599768",
"0.6572738",
"0.6564431",
"0.6520831",
"0.65082985",
"0.6462121",
"0.6445565",
"0.63426... | 0.7335289 | 0 |
Set whether to allow infinite timestamps/dates. Make sure the conversion proc for date reflects that setting. | def convert_infinite_timestamps=(v)
@convert_infinite_timestamps = case v
when Symbol
v
when 'nil'
:nil
when 'string'
:string
when 'float'
:float
when String
typecast_value_boolean(v)
else
false
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def typecast_value_date(value)\n if convert_infinite_timestamps\n case value\n when *INFINITE_DATETIME_VALUES\n value\n else\n super\n end\n else\n super\n end\n end",
"def infinite_timestamp_value(value)\n case c... | [
"0.66383576",
"0.6420522",
"0.62761325",
"0.601918",
"0.5762987",
"0.5707895",
"0.5591486",
"0.55315447",
"0.5378172",
"0.5378172",
"0.5294206",
"0.52896124",
"0.5235742",
"0.521018",
"0.506912",
"0.5042014",
"0.4996655",
"0.49401912",
"0.49288452",
"0.49236864",
"0.49205405"... | 0.75502497 | 0 |
Execute the given SQL with the given args on an available connection. | def execute(sql, opts=OPTS, &block)
synchronize(opts[:server]){|conn| check_database_errors{_execute(conn, sql, opts, &block)}}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute(sql, args=nil)\n q = query(sql, args)\n block_given? ? yield(q) : q.cmd_tuples\n end",
"def execute_query(sql, args)\n @db.log_connection_yield(sql, self, args){args ? async_exec(sql, args) : async_exec(sql)}\n end",
"def execute(sql, args=nil)\n args = args.ma... | [
"0.7904611",
"0.78545374",
"0.78210807",
"0.7775948",
"0.7613696",
"0.74505574",
"0.72905046",
"0.717334",
"0.71629125",
"0.71615505",
"0.7148351",
"0.7138093",
"0.7137035",
"0.70270294",
"0.70190805",
"0.69488543",
"0.69486505",
"0.6940662",
"0.6926925",
"0.68820894",
"0.687... | 0.70047325 | 15 |
+copy_into+ uses PostgreSQL's +COPY FROM STDIN+ SQL statement to do very fast inserts into a table using input preformatting in either CSV or PostgreSQL text format. This method is only supported if pg 0.14.0+ is the underlying ruby driver. This method should only be called if you want results returned to the client. I... | def copy_into(table, opts=OPTS)
data = opts[:data]
data = Array(data) if data.is_a?(String)
if block_given? && data
raise Error, "Cannot provide both a :data option and a block to copy_into"
elsif !block_given? && !data
raise Error, "Must provide either a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy_from path_or_io, options = {}\n options = { delimiter: \",\", format: :csv, header: true, quote: '\"' }.merge(options)\n options[:delimiter] = \"\\t\" if options[:format] == :tsv\n options_string = if options[:format] == :binary\n \"BINARY\"\n ... | [
"0.7032002",
"0.6770422",
"0.66057664",
"0.6383086",
"0.62767667",
"0.60340726",
"0.58851403",
"0.5839566",
"0.5807533",
"0.57698584",
"0.57081026",
"0.5655016",
"0.5653409",
"0.5566205",
"0.5379597",
"0.5323078",
"0.5316464",
"0.5315271",
"0.5310676",
"0.52876455",
"0.517848... | 0.7367899 | 0 |
Listens on the given channel (or multiple channels if channel is an array), waiting for notifications. After a notification is received, or the timeout has passed, stops listening to the channel. Options: :after_listen :: An object that responds to +call+ that is called with the underlying connection after the LISTEN s... | def listen(channels, opts=OPTS, &block)
check_database_errors do
synchronize(opts[:server]) do |conn|
begin
channels = Array(channels)
channels.each do |channel|
sql = "LISTEN ".dup
dataset.send(:identifier_append, s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def listen_to_channel(connection, channel, &block)\n connection.execute(\"LISTEN #{channel}\")\n\n loop do\n connection.raw_connection.wait_for_notify(10) do |event, pid, payload|\n return if yield payload\n end\n end\n ensure\n connection.execute(\"UNLISTEN *\")\n end",
"def notif... | [
"0.734112",
"0.61051863",
"0.60600615",
"0.5844702",
"0.5599413",
"0.5572211",
"0.55013776",
"0.5444815",
"0.5353724",
"0.5312384",
"0.52903867",
"0.52607447",
"0.5257268",
"0.5238882",
"0.522982",
"0.5066929",
"0.5061401",
"0.4985596",
"0.4924846",
"0.49017558",
"0.48918104"... | 0.6936913 | 1 |
If convert_infinite_timestamps is true and the value is infinite, return an appropriate value based on the convert_infinite_timestamps setting. | def to_application_timestamp(value)
if convert_infinite_timestamps
case value
when *INFINITE_TIMESTAMP_STRINGS
infinite_timestamp_value(value)
else
super
end
else
super
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def infinite_timestamp_value(value)\n case convert_infinite_timestamps\n when :nil\n nil\n when :string\n value\n else\n value == 'infinity' ? PLUS_INFINITY : MINUS_INFINITY\n end\n end",
"def convert_infinite_timestamps=(v)\n @convert_inf... | [
"0.80368084",
"0.80133283",
"0.70136845",
"0.6849377",
"0.58645356",
"0.54939365",
"0.5489207",
"0.53575116",
"0.5332459",
"0.5319376",
"0.52651",
"0.519344",
"0.513212",
"0.51072586",
"0.5035853",
"0.49878493",
"0.498601",
"0.49508008",
"0.49464825",
"0.49182823",
"0.4910782... | 0.7542807 | 2 |
Execute the given SQL string or prepared statement on the connection object. | def _execute(conn, sql, opts, &block)
if sql.is_a?(Symbol)
execute_prepared_statement(conn, sql, opts, &block)
else
conn.execute(sql, opts[:arguments], &block)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute(sql, opts=OPTS, &block)\n if opts[:sproc]\n call_sproc(sql, opts, &block)\n elsif sql.is_a?(Symbol)\n execute_prepared_statement(sql, opts, &block)\n else\n synchronize(opts[:server]){|conn| _execute(conn, sql, opts, &block)}\n end\n ... | [
"0.7445554",
"0.7422908",
"0.7357486",
"0.7246502",
"0.7226507",
"0.71983963",
"0.71972597",
"0.71766317",
"0.71016574",
"0.70863456",
"0.7083009",
"0.70563096",
"0.7035786",
"0.70321035",
"0.70274603",
"0.69948757",
"0.697758",
"0.69380987",
"0.69369465",
"0.6917853",
"0.689... | 0.7483042 | 0 |
Execute the prepared statement name with the given arguments on the connection. | def _execute_prepared_statement(conn, ps_name, args, opts)
conn.exec_prepared(ps_name, args)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute_prepared_statement(name, args)\n check_disconnect_errors{exec_prepared(name, args)}\n end",
"def execute(sql, name = nil, binds = [])\n log(sql, name) do\n sql = bind_params(binds, sql) if prepared_statements\n @connection.do(sql)\n end\n end",
"def execute_pr... | [
"0.8060444",
"0.7714628",
"0.76499593",
"0.7505872",
"0.7403695",
"0.7378101",
"0.7176152",
"0.7082819",
"0.7076367",
"0.704002",
"0.703833",
"0.70047003",
"0.68566793",
"0.6823273",
"0.6779913",
"0.67718613",
"0.6749446",
"0.67423135",
"0.67368865",
"0.67130417",
"0.664596",... | 0.8195851 | 0 |
Add the primary_keys and primary_key_sequences instance variables, so we can get the correct return values for inserted rows. | def adapter_initialize
@use_iso_date_format = typecast_value_boolean(@opts.fetch(:use_iso_date_format, Postgres.instance_variable_get(:@use_iso_date_format))) # , true)) # SEQUEL5
initialize_postgres_adapter
add_conversion_proc(17, method(:unescape_bytea)) if USES_PG
add_conversion_proc(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_primary_keys(klazz, string)\n string << \" set_primary_key #{klazz.fields.select {|f| f[:primarykey]}.map {|pk| pk.name.to_sym}.inspect}\\n\\n\"\n string\n end",
"def primary_keys\n ::Kernel.raise Errors::NotImplemented\n end",
"def insert_sequenced(row)\n sql = row.type.insert_s... | [
"0.639773",
"0.63902473",
"0.63513935",
"0.63435245",
"0.6161881",
"0.61553204",
"0.6145978",
"0.6143075",
"0.60911965",
"0.6079128",
"0.6012031",
"0.5986647",
"0.59766793",
"0.5942253",
"0.5938634",
"0.59175503",
"0.590662",
"0.590662",
"0.58845913",
"0.58803105",
"0.5880310... | 0.0 | -1 |
Set the DateStyle to ISO if configured, for faster date parsing. | def connection_configuration_sqls
sqls = super
sqls << "SET DateStyle = 'ISO'" if @use_iso_date_format
sqls
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_style\n @date_style if [:date, :date_range, :month_and_year, :only_year, :date_disabled].include? @date_style.to_sym\n end",
"def use_euro_formats\n self.current_date_format = :euro\n end",
"def format_date\n begin\n self.eob_date = Date.strptime(self.unformatted_eob_date, ... | [
"0.6048192",
"0.5229943",
"0.5126543",
"0.501055",
"0.49447453",
"0.4936957",
"0.4936076",
"0.48847598",
"0.48566493",
"0.48507422",
"0.4844862",
"0.48273945",
"0.48191088",
"0.4818787",
"0.48047313",
"0.47984964",
"0.47938967",
"0.47908103",
"0.478097",
"0.4746114",
"0.47351... | 0.5452926 | 1 |
Execute the prepared statement with the given name on an available connection, using the given args. If the connection has not prepared a statement with the given name yet, prepare it. If the connection has prepared a statement with the same name and different SQL, deallocate that statement first and then prepare this ... | def execute_prepared_statement(conn, name, opts=OPTS, &block)
ps = prepared_statement(name)
sql = ps.prepared_sql
ps_name = name.to_s
if args = opts[:arguments]
args = args.map{|arg| bound_variable_arg(arg, conn)}
end
unless conn.prepared_statements[ps_name] =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute_prepared_statement(name, args)\n check_disconnect_errors{exec_prepared(name, args)}\n end",
"def execute_prepared_statement(ps_name, opts)\n args = opts[:arguments]\n ps = prepared_statement(ps_name)\n sql = ps.prepared_sql\n synchronize(opts[:server]) do |conn... | [
"0.6955069",
"0.6580697",
"0.63122255",
"0.6284847",
"0.62554204",
"0.6185766",
"0.59890246",
"0.5971333",
"0.5964543",
"0.59414786",
"0.5874059",
"0.58605134",
"0.58355135",
"0.57717687",
"0.57630914",
"0.57173634",
"0.5708109",
"0.56787074",
"0.56594557",
"0.5647648",
"0.55... | 0.7185684 | 0 |
Return an appropriate value for the given infinite timestamp string. | def infinite_timestamp_value(value)
case convert_infinite_timestamps
when :nil
nil
when :string
value
else
value == 'infinity' ? PLUS_INFINITY : MINUS_INFINITY
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_timestamp(string)\n DateTime.parse(string).to_i\n end",
"def timestamp_parse(_timestamp)\n _undefined\n end",
"def value_from_s(value)\n a = value.scanf(@format)\n t = 0\n t += a[0] * 3600 if a.size > 0 # hours * seconds-per-hour\n t += a[1] * 60 if a.size > ... | [
"0.67301536",
"0.6327498",
"0.6100885",
"0.6039964",
"0.6016131",
"0.5899857",
"0.5820336",
"0.5796626",
"0.57559997",
"0.5623346",
"0.559958",
"0.55709267",
"0.5555473",
"0.5536436",
"0.5422841",
"0.54129356",
"0.5411092",
"0.5410207",
"0.540438",
"0.5401252",
"0.5388682",
... | 0.7355437 | 0 |
Don't log, since logging is done by the underlying connection. | def log_connection_execute(conn, sql)
conn.execute(sql)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def disable_logging\n @session.connection.disable_logging\n end",
"def autoflush_log; end",
"def autoflush_log; end",
"def log; end",
"def log; end",
"def log; end",
"def log; end",
"def log; end",
"def log; end",
"def log; end",
"def log; end",
"def log\r\n false\r\n end",
... | [
"0.69636",
"0.6710081",
"0.6710081",
"0.62483466",
"0.62483466",
"0.62483466",
"0.62483466",
"0.62483466",
"0.62483466",
"0.62483466",
"0.62483466",
"0.622024",
"0.6150888",
"0.6150197",
"0.6138706",
"0.61209404",
"0.61209404",
"0.61171275",
"0.61171275",
"0.6105711",
"0.6105... | 0.560382 | 70 |
If the value is an infinite value (either an infinite float or a string returned by by PostgreSQL for an infinite timestamp), return it without converting it if convert_infinite_timestamps is set. | def typecast_value_date(value)
if convert_infinite_timestamps
case value
when *INFINITE_DATETIME_VALUES
value
else
super
end
else
super
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def infinite_timestamp_value(value)\n case convert_infinite_timestamps\n when :nil\n nil\n when :string\n value\n else\n value == 'infinity' ? PLUS_INFINITY : MINUS_INFINITY\n end\n end",
"def convert_infinite_timestamps=(v)\n @convert_inf... | [
"0.8253026",
"0.73847604",
"0.6585878",
"0.6431471",
"0.5664912",
"0.5478505",
"0.5446751",
"0.53884166",
"0.53884166",
"0.52656746",
"0.51324284",
"0.51287585",
"0.51222444",
"0.5095602",
"0.50459206",
"0.500709",
"0.49963593",
"0.49341547",
"0.49183714",
"0.48968238",
"0.48... | 0.6667661 | 2 |
If the value is an infinite value (either an infinite float or a string returned by by PostgreSQL for an infinite timestamp), return it without converting it if convert_infinite_timestamps is set. | def typecast_value_datetime(value)
if convert_infinite_timestamps
case value
when *INFINITE_DATETIME_VALUES
value
else
super
end
else
super
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def infinite_timestamp_value(value)\n case convert_infinite_timestamps\n when :nil\n nil\n when :string\n value\n else\n value == 'infinity' ? PLUS_INFINITY : MINUS_INFINITY\n end\n end",
"def convert_infinite_timestamps=(v)\n @convert_inf... | [
"0.8254243",
"0.7386384",
"0.666975",
"0.6434004",
"0.5667342",
"0.54780704",
"0.54476446",
"0.5386003",
"0.5386003",
"0.5263733",
"0.51320237",
"0.5130345",
"0.5125038",
"0.50984293",
"0.504356",
"0.50070506",
"0.49965602",
"0.49327546",
"0.49162784",
"0.4899449",
"0.4881443... | 0.6588314 | 3 |
Yield all rows returned by executing the given SQL and converting the types. | def fetch_rows(sql)
return cursor_fetch_rows(sql){|h| yield h} if @opts[:cursor]
execute(sql){|res| yield_hash_rows(res, fetch_rows_set_cols(res)){|h| yield h}}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_rows(sql)\n execute(sql) do |r|\n i = -1\n cps = db.conversion_procs\n cols = r.fetch_fields.map do |f| \n # Pretend tinyint is another integer type if its length is not 1, to\n # avoid casting to boolean if convert_tinyint_to_bool is set.\n ... | [
"0.71405363",
"0.6875436",
"0.677563",
"0.6739059",
"0.6563565",
"0.6408319",
"0.64009625",
"0.63649267",
"0.6305872",
"0.6287106",
"0.6234882",
"0.6155711",
"0.6152093",
"0.6051693",
"0.59737986",
"0.5910608",
"0.5879965",
"0.58766526",
"0.58493996",
"0.58286136",
"0.5821123... | 0.61954874 | 11 |
Use a cursor for paging. | def paged_each(opts=OPTS, &block)
use_cursor(opts).each(&block)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def page_cursor\n @page_cursor ||= pages.to_enum.lazy\n end",
"def fetch(cursor: -1, count: 50, **options)\n cursor, count = cursor.to_i, count.to_i\n window = count + 2 # Fetch extra two elements for concrete next/prev links\n\n if cursor >= 0\n page = @scope.where(@cursor_... | [
"0.71513885",
"0.69717926",
"0.6739144",
"0.671059",
"0.6684843",
"0.65932316",
"0.6454364",
"0.6418386",
"0.63696945",
"0.6352421",
"0.6315126",
"0.630869",
"0.6179992",
"0.6146985",
"0.6133262",
"0.61300606",
"0.6117421",
"0.6071255",
"0.6042965",
"0.6017693",
"0.6017693",
... | 0.68160516 | 2 |
Replace the WHERE clause with one that uses CURRENT OF with the given cursor name (or the default cursor name). This allows you to update a large dataset by updating individual rows while processing the dataset via a cursor: DB[:huge_table].use_cursor(:rows_per_fetch=>1).each do |row| DB[:huge_table].where_current_of.u... | def where_current_of(cursor_name='sequel_cursor')
clone(:where=>Sequel.lit(['CURRENT OF '], Sequel.identifier(cursor_name)))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_where(table, what, where, *bindvars)\n sql = \"update #{table.name}\\nset #{what} where #{where}\"\n#$stderr.puts sql\n db.do(sql, *bindvars)\n end",
"def current_to_false_sql_statement\n klass = self.class\n lock_column_name = klass.locking_column\n lock_value ... | [
"0.5185605",
"0.5111115",
"0.50961035",
"0.50961035",
"0.50961035",
"0.5060107",
"0.50512356",
"0.5036264",
"0.49734023",
"0.49724764",
"0.49651286",
"0.49085128",
"0.47928664",
"0.47766036",
"0.47595295",
"0.4749393",
"0.47241792",
"0.47152784",
"0.4701604",
"0.46561593",
"0... | 0.68356913 | 0 |
An array of bound variable values for this query, in the correct order. | def map_to_prepared_args(hash)
prepared_args.map{|k| hash[k.to_sym]}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bind_values\n []\n end",
"def bound_variables\n @context.bound_variables\n end",
"def condensed_values\n values = []\n condensed_variables.each do |var|\n values << send(var)\n end\n values\n end",
"def values_array\n [@name, @expression.value]\n end"... | [
"0.7021773",
"0.6377845",
"0.6258958",
"0.62065595",
"0.6098467",
"0.6051704",
"0.59970284",
"0.5984563",
"0.59518844",
"0.5900561",
"0.58304477",
"0.58043385",
"0.579103",
"0.5732291",
"0.57134974",
"0.5661262",
"0.565011",
"0.5636184",
"0.56202203",
"0.5615815",
"0.5588527"... | 0.0 | -1 |
Always assume a prepared argument. | def prepared_arg?(k)
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepare(*)\n raise Error, \"cannot prepare an already prepared statement\" unless allow_preparing_prepared_statements?\n super\n end",
"def prepared_arg_placeholder\n PREPARED_ARG_PLACEHOLDER\n end",
"def call(*)\n raise Error, \"Cannot call prepared statement wi... | [
"0.7035655",
"0.69638205",
"0.6953646",
"0.6940995",
"0.688927",
"0.68674064",
"0.6824744",
"0.6657382",
"0.6598382",
"0.6598382",
"0.6484042",
"0.64726216",
"0.64351463",
"0.64351463",
"0.64128995",
"0.64004356",
"0.6383804",
"0.63483405",
"0.63333327",
"0.6299877",
"0.62885... | 0.6848919 | 6 |
PostgreSQL uses $N for placeholders instead of ?, so use a $ as the placeholder. | def prepared_arg_placeholder
PREPARED_ARG_PLACEHOLDER
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def postgres_binds(query_with_binds)\n bind_index = 0\n query_with_binds.gsub('?') { |match|\n bind_index += 1\n \"$#{bind_index}\"\n }\nend",
"def prepare_statement_sub(sql)\n sql.gsub(/\\$\\d+/, '?')\n end",
"def prepared_statement_arg(v)\n case v\n when Numeric\n v.to... | [
"0.6733609",
"0.657479",
"0.5401105",
"0.53487104",
"0.53409624",
"0.5333208",
"0.53086066",
"0.50910074",
"0.50256133",
"0.4971306",
"0.49156997",
"0.49103904",
"0.49088508",
"0.48526096",
"0.48482475",
"0.48445773",
"0.48445773",
"0.48402953",
"0.483787",
"0.48369294",
"0.4... | 0.52231836 | 7 |
Use a cursor to fetch groups of records at a time, yielding them to the block. | def cursor_fetch_rows(sql)
server_opts = {:server=>@opts[:server] || :read_only}
cursor = @opts[:cursor]
hold = cursor[:hold]
cursor_name = quote_identifier(cursor[:cursor_name] || 'sequel_cursor')
rows_per_fetch = cursor[:rows_per_fetch].to_i
db.send(*(hold ? [:synchron... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each\n (0...record_count).each do |i|\n yield get_record(i)\n end\n end",
"def each\n # Need to close the connection, teh result_set, AND the result_set.getStatement when\n # we're done.\n connection = open_connection!\n\n # We're going to need to ask for item/... | [
"0.6799851",
"0.6772429",
"0.65938264",
"0.65904593",
"0.65655833",
"0.6564742",
"0.65478736",
"0.6546743",
"0.652328",
"0.6497984",
"0.64833355",
"0.6441489",
"0.642705",
"0.642705",
"0.6414251",
"0.63845885",
"0.62919897",
"0.6277137",
"0.6227007",
"0.6220967",
"0.61979157"... | 0.55665255 | 91 |
Set the columns based on the result set, and return the array of field numers, type conversion procs, and name symbol arrays. | def fetch_rows_set_cols(res)
cols = []
procs = db.conversion_procs
res.nfields.times do |fieldnum|
cols << [fieldnum, procs[res.ftype(fieldnum)], output_identifier(res.fname(fieldnum))]
end
self.columns = cols.map{|c| c[2]}
cols
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_column_descriptors\n #skip past header to get to column information\n @data.seek(HEADER_LENGTH)\n \n # column names are the first 128 bytes and column info takes up the last 72 bytes. \n # byte 130 contains a 16-bit column type\n # byte 136 contains a 16-bit length field\n ... | [
"0.6341035",
"0.6265122",
"0.61390173",
"0.61286724",
"0.6065369",
"0.60560626",
"0.6054228",
"0.6051409",
"0.60335994",
"0.6031213",
"0.60208285",
"0.60194063",
"0.599764",
"0.5990914",
"0.5966242",
"0.59636736",
"0.5963157",
"0.59273154",
"0.59227055",
"0.59190816",
"0.5916... | 0.7526813 | 0 |
Use the driver's escape_bytea | def literal_blob_append(sql, v)
sql << "'" << db.synchronize(@opts[:server]){|c| c.escape_bytea(v)} << "'"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def escape_bytea(str)\n # each_byte used instead of [] for 1.9 compatibility\n str.gsub(/[\\000-\\037\\047\\134\\177-\\377]/n){|b| \"\\\\#{sprintf('%o', b.each_byte{|x| break x}).rjust(3, '0')}\"}\n end",
"def escape(string); end",
"def escape(str); end",
"def escape(string)\n ... | [
"0.7539368",
"0.6832843",
"0.6641921",
"0.6616155",
"0.6569809",
"0.6566083",
"0.6548586",
"0.65367967",
"0.6482915",
"0.64156884",
"0.6363001",
"0.63303304",
"0.6325926",
"0.6306962",
"0.6290523",
"0.62771755",
"0.6260701",
"0.6244157",
"0.6196593",
"0.61818475",
"0.61613554... | 0.0 | -1 |
Use the driver's escape_string | def literal_string_append(sql, v)
sql << "'" << db.synchronize(@opts[:server]){|c| c.escape_string(v)} << "'"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def escape(s)\n dummy_conn.escape(s)\n end",
"def escape(string)\n @conn.escape(string.to_s)\n end",
"def escape_string(str)\n raw_connection.escape(str)\n end",
"def escape(string); end",
"def escape(string)\n #This is a stub, used for indexing\n end",
"... | [
"0.80086935",
"0.7992954",
"0.7980062",
"0.7904878",
"0.78952354",
"0.7802086",
"0.7706913",
"0.76025826",
"0.7555844",
"0.754671",
"0.7527131",
"0.7501458",
"0.7473396",
"0.7428927",
"0.74200714",
"0.73981184",
"0.73971426",
"0.73894775",
"0.7380862",
"0.73803616",
"0.729124... | 0.0 | -1 |
For each row in the result set, yield a hash with column name symbol keys and typecasted values. | def yield_hash_rows(res, cols)
res.ntuples.times do |recnum|
converted_rec = {}
cols.each do |fieldnum, type_proc, fieldsym|
value = res.getvalue(recnum, fieldnum)
converted_rec[fieldsym] = (value && type_proc) ? type_proc.call(value) : value
end
y... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_hash(cols=[])\n col_info = column_info(cols)\n rows = []\n while try { @result_set.next } do\n row = {}\n col_info.each do |col, info|\n obj = try{ @result_set.object(info[:index]) }\n case info[:type]\n ... | [
"0.74332345",
"0.7401011",
"0.72184217",
"0.65725565",
"0.6389287",
"0.6387967",
"0.6277099",
"0.62388194",
"0.6235864",
"0.61686397",
"0.6135354",
"0.60972464",
"0.60664576",
"0.6020494",
"0.5997272",
"0.5982124",
"0.59654903",
"0.5965236",
"0.59519607",
"0.5950875",
"0.5938... | 0.7073877 | 4 |
Create an instance for a particular Nelumba::Activity. | def initialize activity, signature = nil, plaintext = nil
@activity = activity
@signature = signature
@plaintext = plaintext
account = activity.actors.first.url
# XXX: Negotiate various weird uri schemes to find identity account
@account = account
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_activity(activity)\n Models::Activity.new(:name => activity.name, :description => activity.description)\n end",
"def create_activity(activity)\n create_or_update(activity, nil,\n 'activity', 'activities')\n end",
"def create_activity!(type, owner)\n create_activit... | [
"0.7712424",
"0.72746414",
"0.69641286",
"0.6732346",
"0.6732346",
"0.66194093",
"0.6532729",
"0.6526759",
"0.648766",
"0.6457502",
"0.6449306",
"0.64436126",
"0.64188987",
"0.6103056",
"0.6073012",
"0.607111",
"0.60684216",
"0.606149",
"0.60382956",
"0.60358834",
"0.60339046... | 0.0 | -1 |
Generate the xml for this notice and sign with the given private key. | def to_xml private_key
# Generate magic envelope
magic_envelope = XML::Document.new
magic_envelope.root = XML::Node.new 'env'
me_ns = XML::Namespace.new(magic_envelope.root,
'me', 'http://salmon-protocol.org/ns/magic-env')
magic_envelope.root.namespaces.namespace = me... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_xml_request\n tax_receipt = generate_tax_receipt\n @certificate.certifica tax_receipt\n @key.sella tax_receipt\n tax_receipt.to_xml\n end",
"def sign(message, private_key)\n msg_point = BLS.norm_p2h(message)\n msg_point * BLS.normalize_priv_key(private_key)\n end",
"def sign_le... | [
"0.6189456",
"0.5949525",
"0.5949234",
"0.59353924",
"0.59199554",
"0.5917015",
"0.58884853",
"0.5887561",
"0.58661014",
"0.582439",
"0.5766398",
"0.57590437",
"0.56318474",
"0.5622876",
"0.56163824",
"0.5600364",
"0.55871844",
"0.55687976",
"0.55659765",
"0.5556279",
"0.5549... | 0.6497375 | 0 |
Check the origin of this notification. | def verified? key
Nelumba::Crypto.emsa_verify(@plaintext, @signature, key)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_origin\n origin = @transport.get_data(\"meta\",\"origin\")\n # compare two arrays with intersection\n return (origin & [@name,@version,@action]).empty?\n end",
"def originated?\n self.state == 'originated'\n end",
"def origin\n origins && origins.length == 1 && origins[0... | [
"0.65892726",
"0.64467144",
"0.6444163",
"0.6413615",
"0.61449504",
"0.5988132",
"0.59232336",
"0.58633226",
"0.5770973",
"0.57301587",
"0.5661349",
"0.56603426",
"0.56603426",
"0.56603426",
"0.5632777",
"0.562097",
"0.5600231",
"0.5464617",
"0.54541916",
"0.54413813",
"0.540... | 0.0 | -1 |
Retrieve the tag from the "tag" object data and apply it to the selection. | def format(b, txtvu)
s, e = txtvu.buffer.selection_bounds
# Our buttons contain Gtk::Stock#Items. Their label values
# begin with "gtk-", ie: gtk-bold, gtk-italic, ... We need
# the word after "gtk-" ie.: bold, italic ... which are used
# as tag property names; Hence Ruby's gsub (sub-string)
# extracts the... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def selected_tags=(data)\n self.tags.clear\n data.split('tag').each { |id| self.tags << Tag.find(id) if id.length > 0 }\n end",
"def tag(tag); end",
"def tag(tag); end",
"def tag_text text_view, tag_type\n s, e = text_view.buffer.selection_bounds\n text_view.buffer.apply_tag(tag_type.tag, s, e)\... | [
"0.6610658",
"0.63108474",
"0.63108474",
"0.6192134",
"0.6185128",
"0.61658216",
"0.60441244",
"0.60328954",
"0.6016391",
"0.60049677",
"0.60049677",
"0.5936232",
"0.5919229",
"0.59021664",
"0.5899758",
"0.58446854",
"0.58446854",
"0.58407354",
"0.5828809",
"0.58242565",
"0.5... | 0.0 | -1 |
Apply the selected text size property as the tag. | def scale_changed(combo, txtvu)
return if combo.active == -1
s, e = txtvu.buffer.selection_bounds
txtvu.buffer.apply_tag(combo.active_text, s, e)
combo.active = -1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def font_size\r\n @style.font_size || @default_font_size\r\n end",
"def change_font_size\n @font_size = 20*(@size_slider.value*2)+20\n #Use change_font_decor to maintain if font is bold or not\n change_font_decor\n end",
"def text_size s, f = font\n f.text_size s\n end",
"def text_size ... | [
"0.666083",
"0.6603351",
"0.6588039",
"0.6588039",
"0.6522651",
"0.6405367",
"0.62887317",
"0.60858434",
"0.60653156",
"0.6023379",
"0.5989415",
"0.5957307",
"0.59424853",
"0.5937337",
"0.5932861",
"0.59297097",
"0.5892705",
"0.5876129",
"0.5867842",
"0.58360225",
"0.5835716"... | 0.5288347 | 55 |
Remove all of the tags from the selected text. | def clear_clicked(txtvu)
s, e = txtvu.buffer.selection_bounds
txtvu.buffer.remove_all_tags(s, e)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy_tag(*tags)\n tags.each do |tag|\n gsub! Regexp.new(\"<\\s*#{tag}[^>]*>.*?<\\s*\\/#{tag}\\s*>\", Regexp::IGNORECASE + Regexp:: MULTILINE), ''\n end\n end",
"def delete_all_tags\n delete_tags(self.tags)\n nil\n end",
"def remove\n from = Suspender.new(d... | [
"0.643675",
"0.6429013",
"0.63510513",
"0.6189877",
"0.60902566",
"0.6028987",
"0.6027333",
"0.60212183",
"0.6015184",
"0.60080105",
"0.5966635",
"0.59562767",
"0.5924286",
"0.5919715",
"0.5914191",
"0.5892503",
"0.58860105",
"0.5863277",
"0.5861183",
"0.58451355",
"0.5801099... | 0.6968981 | 0 |
GET /units/1 GET /units/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def foods_units\n get('/foods/units.json')\n end",
"def units\n @units = Item.select(\"DISTINCT unit\").where(\"unit like ?\", \"%#{params[:q]}%\").limit(20).map(&:unit)\n @units += Detail.select(\"DISTINCT unit\").where(\"unit like ?\", \"%#{params[:q]}%\").limit(20).map(&:unit)\n @units = @uni... | [
"0.8020499",
"0.73782337",
"0.72968423",
"0.72761893",
"0.72446454",
"0.72446454",
"0.72446454",
"0.71800053",
"0.6931266",
"0.68731314",
"0.68319625",
"0.6751599",
"0.6751599",
"0.6751599",
"0.6751599",
"0.6751599",
"0.6751599",
"0.6694411",
"0.66735995",
"0.6655276",
"0.663... | 0.0 | -1 |
POST /units POST /units.json | def create
@unit = Unit.new(unit_params)
@unit.Creator=session[:name]
@unit.CreateDate=Time.now.strftime("%Y-%m-%d %H:%M:%S")
respond_to do |format|
if @unit.save
format.html { redirect_to @unit, notice: '创建成功!.' }
format.json { render :show, status: :created, location: @unit }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @unit = Unit.new(params[:unit])\n\n respond_to do |format|\n if @unit.save\n format.html { redirect_to @unit, notice: 'Unit was successfully created.' }\n format.json { render json: @unit, status: :created, location: @unit }\n else\n format.html { render action: \"... | [
"0.67017543",
"0.67017543",
"0.665163",
"0.66260743",
"0.65848905",
"0.6571388",
"0.6559905",
"0.6513941",
"0.64358485",
"0.643058",
"0.64260685",
"0.64147675",
"0.6377638",
"0.6371824",
"0.63462377",
"0.6335834",
"0.6332594",
"0.6331857",
"0.6330569",
"0.631212",
"0.6300642"... | 0.0 | -1 |
PATCH/PUT /units/1 PATCH/PUT /units/1.json | def update
respond_to do |format|
if @unit.update(unit_params)
format.html { redirect_to @unit, notice: '修改成功!.' }
format.json { render :show, status: :ok, location: @unit }
else
format.html { render :edit }
format.json { render json: @unit.errors, status: :unprocessable_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n params.require(%i[id units])\n retrieve_and_validate_put.update!(units: params[:units])\n head :no_content\n end",
"def update\n url = 'https://casa-core.herokuapp.com/api/units/' + params[:id]\n query = {\n 'name' => params[:name]\n }\n response = HTTParty.put(url, :query... | [
"0.78404903",
"0.7101422",
"0.69241214",
"0.68288046",
"0.67853415",
"0.67808515",
"0.6655101",
"0.66174465",
"0.6590445",
"0.6557427",
"0.6543846",
"0.6528425",
"0.65177476",
"0.65111494",
"0.64887244",
"0.64756674",
"0.64402443",
"0.6405222",
"0.6357104",
"0.63470876",
"0.6... | 0.65195906 | 12 |
DELETE /units/1 DELETE /units/1.json | def destroy
@unit.destroy
respond_to do |format|
format.html { redirect_to units_url, notice: '删除成功!' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n url = 'https://casa-core.herokuapp.com/api/units/' + params[:id]\n response = HTTParty.delete(url, :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n redirect_to units_url, notice: 'Unit was successfully deleted.'\n end",
"def destroy\n @unit.destroy\n respond_to do |form... | [
"0.7785851",
"0.76692647",
"0.7640569",
"0.7640569",
"0.7640569",
"0.7640569",
"0.76393604",
"0.75941813",
"0.7526625",
"0.7423007",
"0.7408337",
"0.7406485",
"0.73811907",
"0.73450744",
"0.7330169",
"0.7308755",
"0.7216169",
"0.72083074",
"0.7170146",
"0.7147241",
"0.7145571... | 0.7450989 | 9 |
Use callbacks to share common setup or constraints between actions. | def set_unit
@unit = Unit.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6165152",
"0.60463154",
"0.59467196",
"0.5917112",
"0.5890387",
"0.58345735",
"0.57773316",
"0.56991524",
"0.56991524",
"0.565454",
"0.5622282",
"0.54232633",
"0.54119074",
"0.54119074",
"0.54119074",
"0.53937256",
"0.53801376",
"0.5358599",
"0.53412294",
"0.5340814",
"0.5... | 0.0 | -1 |
Only allow a list of trusted parameters through. | def unit_params
params.require(:unit).permit(:Unitcode, :name, :Unitaccuracy, :Roundingtype,:fbillstatus,:Creator,:CreateDate,:Approver,:ApproverDate)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\... | [
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.63264... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.